Skip to content

添加 tis 平台的其他功能 #3

Description

@iydon

仓库名称为 SUSTech_Tools,因此可以整理一下常用的工具,比如将 tis 平台的选课、查看成绩等接口以库的形式整合,然后,使用 click 等命令行交互相关的库制作命令行工具(只是一个幻想)。另外,可以使用 pipenv 或者 poetry 等工具管理虚拟环境与依赖。

可供参考的两个脚本:研究生分数查询及 GPA 计算电费余量查询,这两个脚本的创作时间相差较大,因此风格不一致。不过,目前我还没有想好整合的形式,下面调用形式仅抛砖引玉。

from sustech import SUSTech  # or `from sustech import CAS`

sustech = SUSTech.login(username=..., password=...)

sustech.tis.select(...)  # 选课、退课等其他功能

print(sustech.tis.grades(is_undergraduate=True))
print(sustech.ehall.dfyl(195, 209))

如果以库的形式整合,那么就可以在文件夹中新建 __main__.py 文件,直接可以 python 加文件夹名即可启动。使用 click 的抛砖引玉如下,比如第一次可以输入账号密码,之后就缓存在本地。

λ python <文件夹名>
Usage:  [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  select  课程选择
  grades  查询课程成绩
  dfyl    查询电费余量

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions