Giter Club home page Giter Club logo

cli_cqu's Introduction

重庆大学(CQU)的命令行客户端

注意:由于重庆大学教务管理系统更新,旧 API 不再返回内容(老教务网的成绩查询功能依然可用),因此查询课表功能失效。

提供以下功能:

  • 查询成绩
    • 通过老教务网的接口获取成绩单

使用

在命令行运行可执行程序 cli-cqu 即可进入 CLI CQU 的交互式 Shell 中,可以采用类似于命令行的操作方式。 进入 REPL 后,提示符被替换为 cli cqu>

第一次运行时,需要输入用户名与密码,分别需要教学管理(jxgl)和老教务网(oldjw)的两个帐号,两个帐号的密码不一定相同,一般来说,老教务网的密码会是初始密码(身份证后 6 位)。 账户信息会保存到本地( ~/.config/cli-cqu/account.toml ),之后使用时会直接从文件读取,而无需手动输入。如果有更改,需自行修改文件内容。

  1. 退出程序:

    exit
    
  2. 查询帮助:

    help [command_name]
    

当无参数时,此命令会显示程序整体的帮助信息;当后缀一个命令名时,将显示对应命令的帮助信息。

  1. 下载全部成绩(JSON 格式):

    assignments-json filename
    

所有学期的全部科目 的成绩以 JSON 的格式下载至 filename 指定的路径。

安装

你可以使用 pip 安装,由于使用了 f-string,需要 python 3.6 以上:

pip install cli-cqu

或者使用 pipx

pipx install cli-cqu

贡献

此项目基于 MIT 协议发行,你可以在遵守协议的情况下做任何事。

下面是本项目各模块的介绍

  • cli_cqu App 对象和命令行接口
    • cli_cqu.login 模块是登录功能
    • cli_cqu.data 模块是需要用到的数据,例如常量、路由、解析规则(函数)等。
      • cli_cqu.data.ua User-Agent。
      • cli_cqu.data.js_equality 与 jxgl 网页前端的 js 等效的一些函数。
      • cli_cqu.data.route 路由,根据 jxgl 的功能模块分类
      • cli_cqu.data.schedule 日程表
    • cli_cqu.model 数据模型
    • cli_cqu.util 其他辅助功能

cli_cqu's People

Contributors

hagb avatar zombie110year avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hagb cirosantilli

cli_cqu's Issues

BUG:example/download_courses_table.py

download_courses_table.py 中 line15 的

app.courses_table()

报错

Traceback (most recent call last):
  File "download_courses_table.py", line 15, in <module>
    app.courses_table()
AttributeError: 'App' object has no attribute 'courses_table'

或许应该是

app.courses_json() # or app.courses_ical()

BUG:当执行 courses-ical 时取到 None

cli cqu> courses-ical
=== 下载课程表,保存为 ICalendar ===
Traceback (most recent call last):
  File "c:\users\zom\scoop\apps\miniconda3\current\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\zom\scoop\apps\miniconda3\current\lib\runpy.py", line 85, in _run_code           exec(code, run_globals)
  File "C:\Users\zom\.local\bin\cli-cqu.exe\__main__.py", line 7, in <module>
  File "c:\users\zom\.local\pipx\venvs\cli-cqu\lib\site-packages\cli_cqu\__init__.py", line 217, in cli_main
    app.mainloop()
  File "c:\users\zom\.local\pipx\venvs\cli-cqu\lib\site-packages\cli_cqu\__init__.py", line 61, in mainloop
    self.__run_cmd(cmd)
  File "c:\users\zom\.local\pipx\venvs\cli-cqu\lib\site-packages\cli_cqu\__init__.py", line 87, in __run_cmd
    self.courses_ical()
  File "c:\users\zom\.local\pipx\venvs\cli-cqu\lib\site-packages\cli_cqu\__init__.py", line 162, in courses_ical
    courses = self.__get_courses()
  File "c:\users\zom\.local\pipx\venvs\cli-cqu\lib\site-packages\cli_cqu\__init__.py", line 173, in __get_courses
    info = Parsed.TeachingArrangement.personal_courses(self.session)
  File "c:\users\zom\.local\pipx\venvs\cli-cqu\lib\site-packages\cli_cqu\data\route.py", line 47, in personal_courses
    是否周次 = {"text": "周次", "value": el_是否选择周次.attrs["value"]}
AttributeError: 'NoneType' object has no attribute 'attrs'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.