Skip to main content

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。

许可证

AGPL-3.0

Metadata

Release files for hnu_query 0.1.2

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.2
File Size Uploaded Provenance Actions
hnu_query-0.1.2.tar.gz 157.9 kB Without provenance Details for hnu_query-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 277.9 kB

Release files / hnu_query-0.1.2.tar.gz

Download URL hnu_query-0.1.2.tar.gz
Size 157.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d4920baac06fd723a512a5c1f2069b96908a72190611ce616086679664039671
BLAKE2b-256 checksum
How to use checksums
4d17bc2b7cc47328a119f7be255a2760fc7e1bfeda911860e921257c33b55992
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.2-py3-none-any.whl

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

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