1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| import json
import requests import bs4 import re import pandas as pd import csv
url='http://jwgl.sdust.edu.cn/app.do' headers={ 'Referer': 'http://jwgl.sdust.edu.cn/jsxsd/xsxj/xjxxgl.do?Ves632DSdyV=NEW_XSD_XJCJ', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36 Edg/99.0.1150.39' }
def login(ac,pwd): post_data={ "method" : "authUser", "xh" : ac, "pwd": pwd, "token":"" } session=requests.session() req=session.get(url,headers=headers,params=post_data, timeout = 5) s=json.loads(req.text) headers["token"]=s["token"] def get_grade(xh,sy=""): params = { "method": "getCjcx", "xh": "", "xnxqid": sy } session=requests.session() req = session.get(url, params=params, timeout=5, headers=headers) print("全部成绩" if sy == "" else sy) s=json.loads(req.text) if s[0] != None: s = json.loads(req.text) for x in s: print("%s %d %s" % (str(x["zcj"]), x["xf"], x["kcmc"])) else: print("空")
if __name__=='__main__': a=input("请输入你的学号\n") b=input("请输入你的密码\n") losgin(a,b) get_grade(a,"")
|