【Python】检测期末考试是否出分(好分数版)
本帖最后由 WoShiXXX 于 2021-1-5 09:39 编辑昨天那个检测脚本的试用人群太少了,今天发个好分数版本的(PS:该脚本未测试过,有问题欢迎跟帖)
import requests
import json
import smtplib
headers = {
'accept': 'application/json, text/plain, */*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9',
'cookie': '', #此处填写Cookie
'origin': 'https://hfs.yunxiao.com',
'referer': 'https://hfs.yunxiao.com/',
'sec-ch-ua': '%22Google%20Chrome%22%3Bv%3D%2287%22%2C%20%22%20Not%3BA%20Brand%22%3Bv%3D%2299%22%2C%20%22Chromium%22%3Bv%3D%2287%22',
'sec-ch-ua-mobile': '?0',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
}
res = requests.get('https://hfs-be.yunxiao.com/v3/exam/list?start=-1',headers = headers)
rjson = json.loads(res.text)
if rjson['data']['list']['totalCount'] == 9:
# 开始配置邮件信息
mail_host = 'smtp.yeah.net'
mail_user = 'mail_user'
mail_pass = 'mail_pass'
sender = 'sender'
receivers = ['xxxx@qq.com' , 'xxxxx@163.com']
# 结束配置邮件信息
# 开始设置邮件内容
message = MIMEText('hello,this is a test','html','UTF-8')
message['Subject'] = '出分了'
message['From'] = 'zzjzxq <' + sender + '>'
message['To'] = 'xxx <' + receivers + '>'
message['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime())
# 结束设置邮件内容
try:
smtpObj = smtplib.SMTP()
#连接到服务器
smtpObj.connect('smtp.yeah.net',25)
#登录到服务器
smtpObj.login(mail_user,mail_pass)
#发送
message_str = message.as_string()
print(message)
print(message_str)
smtpObj.sendmail(sender,receivers, message_str)
message['To'] = 'xxx <' + receivers + '>'
message['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime())
message_str = message.as_string()
smtpObj.sendmail(sender,receivers, message_str)
#退出
smtpObj.quit()
print('success')
except smtplib.SMTPException as e:
print('error',e) #打印错误
# 结束发送邮件
# Server酱推送
res = requests.get('https://sc.ftqq.com/' + '此处填写sckey' + '.send?text=出分数了,请及时关注') 可以的噢 怎么吓人的程序。。。还是别检测号。挺吓人的~ 好好学习 ldwz 发表于 2021-1-5 08:46
怎么吓人的程序。。。还是别检测号。挺吓人的~
哈哈哈 xd你头像xswl 这操作可以的 sdsdsdssc 呵呵小白一个看不太明白! 谢谢楼主分享,谢谢了 下载来试用 有问题后再说与楼主 先谢谢了
页:
[1]
2