湘潭大学校园网登录 API
Project description
湘潭大学 校园网 API
安装
从 PyPI 安装:
pip install xtu-network
从 GitHub 安装:
pip install git+https://github.com/xtu-hit/xtu-network-python.git@main#egg=xtu-network
示例
简单代码示例
from xtu.network import XtuNetwork
from xtu.network import NoLoginError
from xtu.network import OnlineUserInfo
async def main():
async with XtuNetwork(202400001111, "rsa_password") as xtu:
print(await xtu.login())
print(await xtu.checkOnline())
print(await xtu.getErrorMsg())
print(res := await xtu.getOnlineUserInfo())
print(OnlineUserInfo.get_online_count_from_ball_info(res["ballInfo"]))
print(await xtu.checkNetwork())
try:
print(await xtu.logout())
except NoLoginError:
pass
详见 example.py 用法
说明
XtuNetwork类用于连接校园网。getErrorMsg()乍一看是获取错误信息,实际上什么也不返回,但是不调用此 API 的话getOnlineUserInfo就无法正确返回。getOnlineUserInfo()用于获取在线用户信息,返回一个字典。checkNetwork()用于检查网络状态,返回一个布尔值。logout()用于退出校园网,无返回值,如果尚未登录则抛出NoLoginError异常。
如何获得 RSA 加密后的密码?
使用 security.html 获取,或者 F12 查看校园网登录请求。
开源协议
本仓库使用 AGPL-3.0 协议,注意事项:
-
源代码共享义务:使用或修改此软件进行开发或提供网络服务时,必须提供完整的源代码。
-
网络应用条款:若通过网络向用户提供此程序的功能,必须确保用户能够获取到相应的源代码。
-
许可证继承:任何分发的修改版必须继续使用AGPL-3.0许可证,确保后续版本的开放性和共享要求。
-
修改版标识:任何分发的修改版本须在显著位置标明已修改,并附上具体修改的内容和日期。
-
专利权警示:使用此软件即表明你接受并遵循软件中规定的专利权限。
-
免责条款:软件按“现状”提供,不提供任何明示或暗示的保证。使用软件所产生的任何风险由用户自行承担。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xtu_network-0.0.25.tar.gz.
File metadata
- Download URL: xtu_network-0.0.25.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4901c5984fa01eb56cd3f5f29925c55831b0fc5632874e321dcdd6e4c8b65f7
|
|
| MD5 |
0aedd91e5520c930b0615ebea102cfb6
|
|
| BLAKE2b-256 |
63407deb18829860fd7631389e6be28e11486ee16a9be92483adb64fc3c335e2
|
File details
Details for the file xtu_network-0.0.25-py3-none-any.whl.
File metadata
- Download URL: xtu_network-0.0.25-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e1722d2e1daa30af652b3fb4a79bbfea2618f1d9d0ac3ce59814067d654eaaa
|
|
| MD5 |
9405be62512cfbb310ad6e2536e90acb
|
|
| BLAKE2b-256 |
e20e6de491405f875f03da68841e737c44f38330239ac0d98dc3868efc09d08c
|