Skip to main content

HNU Query(Python)

湖南大学校内系统异步查询库,由 Rust 项目 qnxg/hnu_query 移植而来。

支持教务、体测、实验平台、校园网流量、门户、学工、研究生系统、CG、AI 平台和宿舍电量等查询。

安装

需要 Python 3.10+,在项目根目录执行:

pip install -e .

真实查询需连接湖南大学校园网或 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。

许可证

AGPL-3.0

Metadata

Release files for hnu_query 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hnu_query 0.1.1
File Size Uploaded Provenance Actions
hnu_query-0.1.1.tar.gz 157.7 kB Without provenance Details for hnu_query-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hnu_query 0.1.1
File Interpreter ABI Platform Actions
hnu_query-0.1.1-py3-none-any.whl Python 3 none any Details for hnu_query-0.1.1-py3-none-any.whl

Total release size: 277.7 kB

Release files / hnu_query-0.1.1.tar.gz

Download URL hnu_query-0.1.1.tar.gz
Size 157.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4210f9745dd386f81d8b73a34f9f498875f214ae74e777b319b3680b30cef3d1
BLAKE2b-256 checksum
How to use checksums
24978f235ab8ee917a590161bb8759c6fa047e37c372d1f1d1c4bd47e93d055b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.1-py3-none-any.whl

Download URL hnu_query-0.1.1-py3-none-any.whl
Size 120.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dd50ac0eceb04af4bc0c8d4fd3a69d4b71d00d57b7b53c39f591b38582ae272
BLAKE2b-256 checksum
How to use checksums
afaaf892caeca20ce22c237bd705f8544f94b50803f291359094a09e6030909e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","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.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page