五邑大学乘方教务系统 Python SDK(参考实现,理论兼容其他乘方学校)
Project description
wyu-jwxt
五邑大学乘方教务系统 Python SDK。以五邑大学为参考实现,base_url 可配,理论兼容其他乘方教务学校。
登录加密算法、接口协议全部逆向自
jxgl.wyu.edu.cn实测,理论兼容其它乘方教务系统。
安装
git clone https://github.com/RS-Nocsi/wyu-jwxt.git
cd wyu-jwxt
pip install -e . # 基础安装
pip install -e ".[ocr]" # 含验证码自动识别(推荐)
快速开始
from wyu_jwxt import Client
client = Client(base_url="https://jxgl.wyu.edu.cn")
client.login("学号", "密码") # 自动处理验证码 + AES 加密
schedule = client.get_schedule(2025, 2) # 课表
grades = client.get_grades(2025, 2) # 成绩
exams = client.get_exams(2025, 2) # 考试
info = client.get_student_info() # 学籍
功能
| 方法 | 说明 | 返回类型 |
|---|---|---|
client.login(username, password) |
登录 | None |
client.get_schedule(xn, xq, week=None) |
课表查询 | List[Course] |
client.get_grades(xn=None, xq=None) |
成绩查询 | List[Grade] |
client.get_exams(xn, xq) |
考试安排 | List[Exam] |
client.get_student_info() |
学籍卡片 | StudentInfo |
client.save_session(path) |
保存登录态 | None |
Client.from_session(path) |
加载登录态 | Client |
数据模型
所有 SDK 属性均映射自教务系统原始 JSON/HTML 字段。详见 docs/API.md。
Course(课表)
| 属性 | 类型 | 教务字段 | 示例 |
|---|---|---|---|
name |
str |
kcmc |
大学英语(2) |
teacher |
str |
teaxms |
小明 |
classroom |
str |
jxcdmc |
XXX教学楼203 |
start_time |
str |
qssj |
08:15:00 |
end_time |
str |
jssj |
09:50:00 |
weekday |
int |
jsxq |
2 (1=周一 ... 7=周日) |
weeks |
List[int] |
zc |
[1,2,3,4,5,7,8,9,...] |
term_code |
str |
xnxqdm |
202502 |
course_code |
str |
kcbh |
0400012 |
Grade(成绩)
| 属性 | 类型 | 教务字段 | 示例 |
|---|---|---|---|
course_name |
str |
kcmc |
高等数学 |
score |
str |
zcj |
88 |
credit |
float |
xf |
5.0 |
term |
str |
xnxqmc |
2025-2026-2 |
department |
str |
kkbmmc |
XX学院 |
nature |
str |
xdfsmc |
必修 |
course_code |
str |
kcbh |
2120410020 |
student_name |
str |
xsxm |
张三 |
Exam(考试)
| 属性 | 类型 | 教务字段 | 示例 |
|---|---|---|---|
course_name |
str |
kcmc |
大学物理 |
date |
str |
ksrq |
2026-07-06 |
time |
str |
kssj |
15:00:00--17:00:00 |
classroom |
str |
kscdmc |
XXX教学楼201 |
exam_form |
str |
ksxsmc |
闭卷 |
exam_type |
str |
khxsmc |
笔试 |
StudentInfo(学籍)
数据来自 welcome 页(data-userbh/data-userxm)+ edit.page 表单。
| 属性 | 类型 | 教务字段 | 示例 |
|---|---|---|---|
student_id |
str |
data-userbh |
2021000000 |
name |
str |
data-userxm |
张三 |
id_number |
str |
sfzh |
440000200001010001 |
phone |
str |
dh |
13800000000 |
email |
str |
email |
example@qq.com |
home_address |
str |
jtdz |
XX省XX市... |
exam_number |
str |
ksh |
25440000000000 |
previous_school |
str |
lyzx |
XX中学 |
enrollment_date |
str |
rxrq |
20240901 |
pinyin_name |
str |
py |
Zhang San |
english_name |
str |
xsywxm |
Zhang San |
Session 复用
client.save_session("cookie.cache")
client = Client.from_session("cookie.cache") # 免重新登录
验证码处理
默认使用 ddddocr 自动识别。如需手动输入回退:
from wyu_jwxt import Client, ManualSolver
def my_callback(image_bytes):
with open("captcha.jpg", "wb") as f:
f.write(image_bytes)
return input("请输入验证码: ").strip()
client = Client(manual_solver=ManualSolver(my_callback))
其他乘方学校兼容
from wyu_jwxt import Client, SchoolConfig
class MySchool(SchoolConfig):
base_url = "https://jwxt.other.edu.cn"
# 接口路径或加密方式不同时在此 override
client = Client(config=MySchool())
异常
| 异常 | 触发条件 |
|---|---|
LoginError |
登录失败(密码错/验证码错/双因素触发) |
CaptchaError |
验证码获取或识别失败 |
SessionExpiredError |
未登录时调用数据接口 |
ChengfangError |
基类,可统一捕获所有 SDK 异常 |
许可
MIT License
贡献
此 SDK 的接口协议全部逆向自五邑大学乘方教务系统实测。如果你所在学校也使用乘方教务,欢迎测试兼容性并提交 PR。
Project details
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 wyu_jwxt-0.1.0.tar.gz.
File metadata
- Download URL: wyu_jwxt-0.1.0.tar.gz
- Upload date:
- Size: 19.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76199246c8109f3f9ede096bdb426fc6f6acf62c32280de7fae7cfbfe42c3787
|
|
| MD5 |
dd03109541b099456fbc4baeedb00784
|
|
| BLAKE2b-256 |
d4deaf7614605a5d345cc778d4e6221a9dfe87b5bfcb0aff2bd295fa1d4d8e0a
|
File details
Details for the file wyu_jwxt-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wyu_jwxt-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3861c94693a0cfed7beef00f4232026c9c6424e14040115272ec690696ddb514
|
|
| MD5 |
d7f84e4dbba6bb3fce689860e535862b
|
|
| BLAKE2b-256 |
0fd455e077a2bc5b44975514196889afde7e0caf0b81e8c87f20e86493ad66c8
|