等待过于焦虑,于是写一个自动鸣笛代码来检测是否出成绩。出成绩自动调用winsound.MessageBeep()。主函数里check_new传入学校代码即可。
代码
import requests
import json
import winsound
import time
def alert():
#print('aaa')
times = 5
while(times>0):
winsound.MessageBeep()
times-=1
time.sleep(1)
return 0
def check_new(school):
url = "https://yz.chsi.com.cn/apply/cjcx/sch/"+str(school)+".dhtml"
response = requests.get(url=url)
if response.status_code == 200:
if "请检查您报考的招生单位是否已开通初试成绩查询功能" not in response.text:
print(response.text)
alert()
if __name__ == '__main__':
i=0
while(i<10000):
#check(61,10698)
check_new(10698)
time.sleep(10)
i+=1