HNU Query(Python)
湖南大学校内系统异步查询库,由 Rust 项目 qnxg/hnu_query 移植而来。
支持教务、体测、实验平台、校园网流量、门户、学工、研究生系统、CG、AI 平台和宿舍电量等查询。
安装
需要 Python 3.10+:
pip install hnu_query
真实查询需连接湖南大学校园网或 VPN,并拥有相应系统权限。
快速开始
通过统一身份认证登录教务系统,查询成绩:
import asyncio
import getpass
from hnu_query.cas import acquire_by_login
from hnu_query.hdjw import HdjwClient, acquire_by_cas_login
async def main():
cas_token = await acquire_by_login(input("学号:"), getpass.getpass("个人门户密码:"))
token = await acquire_by_cas_login(cas_token)
async with HdjwClient(token) as client:
# 学年起始年份、教务系统学期编号;按需修改。
for grade in await client.get_grade(2025, 1):
print(grade.model_dump_json())
asyncio.run(main())
文档
开发
uv sync
uv run poe check
包含 lint、格式、类型检查和离线测试,详见 测试方法。
真实请求测试通过 .env 配置,运行 uv run --env-file .env poe test-live。
许可证
Metadata
Release files for hnu_query 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hnu_query-0.1.3.tar.gz | 158.5 kB | Without provenance | Details for hnu_query-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hnu_query-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for hnu_query-0.1.3-py3-none-any.whl |
Total release size: 278.7 kB
Release files / hnu_query-0.1.3.tar.gz
| Download URL | hnu_query-0.1.3.tar.gz |
|---|---|
| Size | 158.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0632f842886cd7952b3993c8a1a3ba7e5dd58896cb3ab9fc3a433791a022e81
|
|
BLAKE2b-256 checksum How to use checksums |
52ca7792998654ddffab8250cc11d076eff1af2b420210f715ee90c7c330c813
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / hnu_query-0.1.3-py3-none-any.whl
| Download URL | hnu_query-0.1.3-py3-none-any.whl |
|---|---|
| Size | 120.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
060ffc31d0937da1cc4eb1a09f99d78f727dff1dc5a63f571ca118e14265e8fd
|
|
BLAKE2b-256 checksum How to use checksums |
8314bdcb89bfc95370576bdba510c7b52d29713eb5f0c45cd6e733dc604d1204
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for hnu_query 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.