GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - HeZ2z/cumt-jwxt-cli: 面向 CUMT 教务系统的 Python CLI,用于查询成绩、检测成绩变化,并在需要时发送邮件通知。

BranchesTags
Open more actions menu

Latest commit

 

History

77 Commits
77 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
docs/images
docs/images
 
 
skills/cumt-jwxt-cli
skills/cumt-jwxt-cli
 
 
src/cumt_jwxt_cli
src/cumt_jwxt_cli
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
config.example.json
config.example.json
 
 
pyproject.toml
pyproject.toml
 
 
uv.lock
uv.lock
 
 

Repository files navigation

CUMT-JWXT-CLI

Python uv pytest ruff License

cumt-jwxt-cli 是面向 CUMT 教务系统的 Python CLI,用于查询成绩和考试安排、检测成绩变化,并在需要时发送邮件通知。

推荐在服务器上定时运行,或在本地交互式使用。支持配置文件和环境变量,适合自动化脚本和定期检查。

当前主命令:

cumt-jwxt grades query
cumt-jwxt exams query
cumt-jwxt schedule query
cumt-jwxt classrooms query --date 2026-11-23
cumt-jwxt class-schedule query --list --campus nanhu --grade 2023
cumt-jwxt academic query
cumt-jwxt courses query --teacher 张三
cumt-jwxt plan query --list --grade 2023 --college 08 --major 0810

报告示例

下图展示了有新的成绩变更时,邮件发送的效果(重要信息已做混淆):

HTML 成绩报告示例

当前能力

  • 读取本地配置和 CUMT_JWXT_* 环境变量。
  • 使用受控 HTTP session 查询教务系统成绩和考试安排。
  • 复用 state.json 中的会话 cookie,会话失效后自动重新登录。
  • 使用本地 ddddocr 识别验证码,图片不离开本机;交互式终端下识别失败可人工输入。
  • 解析成绩列表、检测新增/更新/删除,并生成文本摘要。
  • 按需查询成绩详情,生成 HTML 邮件或本地报告。
  • 查询考试安排并生成文本摘要。
  • 查询个人课表,检测课程新增/变更,并生成文本摘要。
  • 按日期和时段查询空闲教室,支持校区、楼号、座位数和可借用筛选。
  • 按校区、年级、学院、专业筛选班级课表,支持 --list 列出候选并用 --class 查询具体课表或按周过滤。
  • 查询累计学业情况,包括总览 GPA、培养方案学分要求和按课程性质统计。
  • 按课程、教师或场地查询上课情况,支持星期、节次和起始周筛选。
  • 查询专业级教学执行计划,支持按年级、学院、专业定位,列出计划或查看课程。
  • 可选保存成绩/考试 JSON、HTML 报告,以及考试 ICS 日历文件。
  • 可选保存课表 JSON、HTML 报告,以及个人课表 ICS 日历文件。
  • 在检测到成绩变化或显式强制时发送 SMTP 邮件。

安装

克隆仓库

git clone https://github.com/HeZ2z/cumt-jwxt-cli.git
cd cumt-jwxt-cli

项目支持 Python 3.11+。可以使用 uv,也可以使用 pip;推荐 uv。

使用 uv(推荐)

uv sync
uv run cumt-jwxt --help

使用 pip

如果你不使用 uv,也可以直接安装当前项目:

python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install .
cumt-jwxt --help

本地开发时也可以使用可编辑安装:

pip install -e .

快速开始

复制本地配置:

cp config.example.json config.local.json

填写 config.local.json 中的教务系统账号和查询学期后运行(验证码默认本地识别,交互式终端下识别失败可手动输入):

uv run cumt-jwxt grades query
uv run cumt-jwxt exams query
uv run cumt-jwxt schedule query
uv run cumt-jwxt classrooms query --date 2026-11-23 --start 08:00 --end 09:40
uv run cumt-jwxt class-schedule query --list --campus nanhu --grade 2023
uv run cumt-jwxt academic query

适合定时任务的非交互命令:

uv run cumt-jwxt grades query --config ./config.local.json --no-interactive
uv run cumt-jwxt exams query --config ./config.local.json --no-interactive
uv run cumt-jwxt schedule query --config ./config.local.json --no-interactive
uv run cumt-jwxt classrooms query --date 2026-11-23 --config ./config.local.json --no-interactive
uv run cumt-jwxt class-schedule query --list --campus nanhu --config ./config.local.json --no-interactive
uv run cumt-jwxt academic query --config ./config.local.json --no-interactive

最小配置示例

{
  "cumt": {
    "username": "your-student-id",
    "password": "your-password"
  },
  "query": {
    "year": "2026",
    "semester": "3"
  },
  "captcha": {
    "manual_timeout_seconds": 60
  },
  "notify": {
    "enabled": false
  }
}

敏感字段可以通过环境变量提供,完整配置说明见 skills/cumt-jwxt-cli/references/configuration.md。

查询学期(query)

query.year 是学年起始年(如 2025 表示 2025-2026 学年),query.semester 是学期代码(3 为秋季/第一学期,12 为春季/第二学期)。取值优先级从高到低:

  1. --year / --semester
  2. 配置文件中的 query.year / query.semester
  3. query.auto 为 true 时,登录后读取教务系统当前学期
  4. 教务系统取不到学期时,按当前系统时间(北京时间)推导
  5. 仍无法确定时报错

开启自动检测后可以省略 year、semester(或设为 null):

{
  "query": {
    "year": null,
    "semester": null,
    "auto": true
  }
}

自动检测会在登录成功后读取教务系统当前学年学期;如果页面结构变化或读取失败,会回退到日历推导。日历规则为:9 月至次年 1 月为秋季学期,2 至 8 月为春季学期,1 月仍归属上一学年的秋季学期。这是按日历的近似值,开学与期末日期逐年浮动;跨学期边界运行定时任务时建议显式传 --year / --semester,避免学年学期切换被变更检测当成一次全量变更。

输出文件命名

启用可选输出后,产物文件名会带学年学期后缀,便于多学期并存:

  • 成绩 JSON:grades_<yy><sp|fa>.json
  • 成绩 HTML:grade_report_<yy><sp|fa>.html
  • 考试 JSON:exams_<yy><sp|fa>.json
  • 考试 HTML:exam_report_<yy><sp|fa>.html
  • 考试 ICS:exam_schedule_<yy><sp|fa>.ics
  • 课表 JSON:schedules_<yy><sp|fa>.json
  • 课表 HTML:schedule_report_<yy><sp|fa>.html
  • 课表 ICS:schedule_<yy><sp|fa>.ics

其中 sp 表示春季学期,fa 表示秋季学期。例如 grades_26sp.json、exam_schedule_25fa.ics、schedule_25fa.ics。

文档

完整使用与开发说明放在项目内 agent skill skills/cumt-jwxt-cli/SKILL.md:

  • 命令参考
  • 配置参考
  • 运行、安全与故障排查
  • 开发约定

开发

uv sync
uv run pytest
uv run ruff check .

项目结构:

  • src/cumt_jwxt_cli/cli.py:CLI 参数解析和命令入口
  • src/cumt_jwxt_cli/config.py:配置加载
  • src/cumt_jwxt_cli/client/:登录、session 和 HTTP 交互
  • src/cumt_jwxt_cli/captcha/:验证码识别
  • src/cumt_jwxt_cli/grades/:成绩查询、解析、快照、报告
  • src/cumt_jwxt_cli/exams/:考试安排查询、解析、报告
  • src/cumt_jwxt_cli/schedule/:个人课表查询、解析、报告
  • src/cumt_jwxt_cli/class_schedule/:班级课表查询、解析、报告
  • src/cumt_jwxt_cli/notify/:邮件通知
  • tests/:pytest 测试

更多开发约定见 skills/cumt-jwxt-cli/references/development.md。

安全说明

不要提交或分享:

  • config.local.json
  • config.json
  • state.json
  • logs/
  • output/
  • 账号、密码、API Key、cookie、session、验证码图片或真实教务系统响应

项目默认遵循最小必要保存原则,但本地配置、状态文件、日志、邮件服务商和代理环境仍可能引入额外风险。使用前请阅读 skills/cumt-jwxt-cli/references/operations.md。

免责声明

本项目仅用于个人自动化查询本人教务成绩信息。使用者应自行确保遵守学校教务系统使用规范,控制查询频率,并妥善保管本地配置、状态文件和邮件账号凭据。

许可证

本项目使用 MIT License。

About

面向 CUMT 教务系统的 Python CLI,用于查询成绩、检测成绩变化,并在需要时发送邮件通知。

Resources

Readme
MIT license
Activity

Stars

7 stars

Watchers

1 watching

Forks

1 fork
Report repository

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.