zf School SDK for Python
Project description
新版正方系统 Python SDK。(支持自动识别、处理滑块验证码与常规验证码,如果觉得还不错,给个小星星趴~⭐)
这是全网唯一一个自动处理验证码的新版教务系统 SDK :p
并且本项目有完善的 type hints
📢📢📢 本项目理论上支持教务系统所有功能,兼容所有学校
使用过程中如有遇到本 SDK 暂不支持的功能,请使用 proxy_request
支持的登录/验证码方式
- 帐号密码登录
- 滑块验证码登录
- 图形验证码登录
- cookie 登录(用于扫码登录、OIDC 等场景)
测试环境
- Python == 3.8
- 默认验证码识别方式(推理): CPU
Usage
$ pip install school-sdk
# or
$ pip install zf-school-sdk
如果机器内存不足,可以使用 pip
--no-cache-dir选项来安装 e.g:pip --no-cache-dir install school-sdk
from school_sdk import SchoolClient
from school_sdk.client import UserClient
# 先实例化一个学校,再实例化用户
school = SchoolClient("172.16.254.1")
user:UserClient = school.user_login("2018xxxxx", "xxxxxxxx")
# 获取 2020 学年第二学期的课程
course = user.get_schedule(year=2020, term=2)
print(course)
使用示例参见 examples
Api Function
| Api | Description | Argument |
|---|---|---|
| user_login | 登陆函数 | account, password |
| get_schedule | 课表查询 | year, term |
| get_score | 成绩查询 | year, term |
| get_info | 获取个人信息 | None |
| refresh_info | 刷新个人信息 | None |
| check_session | 检查session并其失效后重登录 | None |
| proxy_request | 补充 sdk 未实现的业务功能,以支持各种登录后的教务系统操作 | method, url_or_endpoint, **kwargs |
School-SDK Options
| Option | Default | Description |
|---|---|---|
| host | 不存在默认值 | 教务系统地址(必填) |
| port | 80 | 端口号 |
| ssl | False | 教务系统是否使用https |
| name | None | 学校名称 |
| exist_verify | False | 是否存在验证码 |
| captcha_type | captcha | 验证码类型,枚举类型(kaptcha: 常规 或 captcha: 滑块) |
| retry | 10 | 登录重试次数 |
| lan_host | None | 内网地址(暂不可用) |
| lan_port | 80 | 内网地址端口(暂不可用) |
| timeout | 10 | 全局请求延时 |
| url_endpoints | None | 地址配置 |
相关项目
帮教务系统做负载均衡:https://github.com/FarmerChillax/school-load-balance
(如果你们学校教务系统抢课经常崩溃,可以考虑看看这个 repo)
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 zf-school-sdk-1.7.0.tar.gz.
File metadata
- Download URL: zf-school-sdk-1.7.0.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
804bce92c8719b76f67bbc16717b64f90151bf0da6205f871de0f5d4d6ebda20
|
|
| MD5 |
381094c1019b5ae7eaf059e9e0637658
|
|
| BLAKE2b-256 |
bcc7c5ac221627008916e2189a896a02e33b63cfb26e2bd88c3e7ef10c8a756f
|
File details
Details for the file zf_school_sdk-1.7.0-py3-none-any.whl.
File metadata
- Download URL: zf_school_sdk-1.7.0-py3-none-any.whl
- Upload date:
- Size: 38.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d08b2bfa6e9a98e225bebe710c18cd98f64eef03b1f6a7d88c05106a5508acc
|
|
| MD5 |
d4bea40b35e85f14ab85870a00242235
|
|
| BLAKE2b-256 |
18db4a8395c1fca80124bafe8eb5e7c3fbd22bfcdabbecc59b49acb58a7870f5
|