Skip to main content

ZF-API 正方教务系统API

正方教务系统信息api,方便开发者二次开发。本着不想重复造轮子的心态,搜索了市面上开源的教务系统爬虫,发现对于本校的教务系统不适用,故参考了部分的正方教务系统的爬虫,尽可能的解决各方面的bug,因此创建此项目。如果有朋友也需要欢迎提issues,尽量解决。

PS:因为之前写过老版本正方教务系统的爬虫,没想刚写完学校升级教务系统了。后期会把旧版的也改写成api,方便部分没升级的同学使用。也推荐各位大佬推荐其他常用的教务系统,希望打造成一个全面的教务系统api or sdk。

后面会添加选课与抢课功能,与微信公众号小程序配合等等,还有最最最重要的一键评价。

原理:

爬虫方面登陆后使用cookies带入,然后抓包分析参数即可,至于登陆方面的加密,百度搜索有比较详细的讲解。

已实现功能:

  • 支持新版正方教务、旧版正方教务还未支持

  • 自动登陆、cookies获取

  • 获取个人信息

  • 获取学校通知

  • 调课、改课消息

  • 获取个人成绩

  • 获取课程表

  • 获取考试信息

  • 可返回原始正方数据json格式

如何使用:

  • 使用pip命令安装pip install zfapi

  • 或者手动安装

    • tar -zxvf 包名.tar.gz
      cd 包名
      python setup.py build
      python setup.py install
      

小试牛刀

运行如下代码:

from zfapi import *

base_url = 'http://xxxx/'

l = Login(base_url=base_url)
l.login('账号', '密码')
cookies = l.cookies
srpihot = GetInfo(base_url=base_url, cookies=cookies)
print(srpihot.get_information())

详细API介绍

详细查看这些例子

感谢以下项目:

Release files for zfapi 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zfapi 0.0.1
File Size Uploaded
zfapi-0.0.1.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for zfapi 0.0.1
File Interpreter ABI Platform
zfapi-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / zfapi-0.0.1.tar.gz

Download URL zfapi-0.0.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
83825d42e0f1476c5b620f80f15ea7e9a7dfc71c58dc096ffdac73d320881280
BLAKE2b-256 checksum
How to use checksums
5b9a005dc48550c12285eca169835eb05f2b0b39b3b6162dddc76155af59cd53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.0

Release files / zfapi-0.0.1-py3-none-any.whl

Download URL zfapi-0.0.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3943f319c94e8757fce55baf47107d7b5f3b8ec9920d4f3252c699f60a67cb8
BLAKE2b-256 checksum
How to use checksums
6489c368bd6bfdf6eb79a16f6dde5c718bde750c452630158d5a3d34bf3f58e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page