前景:由于yq上学期考试推迟了,导致本学期考了,现在成绩还查不到,整天去关注也麻烦,于是部署个在服务器检测的脚本,出成绩后推送到微信邮箱
import requests
import time
def ceshi():
cookies = {
#这里填写你自己的cookie
'__pInId__': '',
'SESSION': '',
}
headers = {
'Connection': 'keep-alive',
'Accept': '*/*',
'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',
'X-Requested-With': 'XMLHttpRequest',
'Referer': 'http://jwweb.ymu.edu.cn/for-std/grade/sheet/semester-index/263542',
'Accept-Language': 'zh-CN,zh;q=0.9',
# Requests sorts cookies= alphabetically
# 'Cookie': '__pInId__=7ea41737b5f71b35fcbc4b4d4ded352a; SESSION=ff9cafc5-aa68-4ce7-b1af-607ea7a2afad',
}
response = requests.get('http://jwweb.ymu.edu.cn/for-std/grade/sheet/get-not-retake-grade/263542', headers=headers,cookies=cookies, verify=False)
back=response.json()
print(back['notRetakeGradeIds'])
if len(back['notRetakeGradeIds']) == 0:
print("没有数据")
else:
requests.get("邮箱推送url")
print("出成绩啦")
# 发给我、🐎杰
time.sleep(20)
ceshi()
if __name__ == '__main__':
ceshi()
# print(response.content)
# print(response.headers)
运行日志