体温打卡python 可通过账户密码获取对应ID号
仅用于学习和测试,请勿自动填报或者干任何违法的事情
import datetime import hashlib import random from urllib.parse import quote import requests import time USRID=123456 def msg(name): url = 'https://qmsg.zendee.cn/send/xxxxxxxxxxxxxxxxx?msg=' + quote(name) r = requests.get(url) print(r.json()['reason']) def getAttrs(): random_str = ['1tddiejat2w', 's9rv1kijwz9', '0cr1jr4xjde', 'a0k8xrv1wyw', 'ewmww899uf7', 'jtev75ngjwg'] time_str = int(time.time()) sign_str_o = random.choice(random_str).upper() + str(time_str) + 'Q9y1Vr5sbjGwR8gekNCzELhZioQb9UZw' sign_str = hashlib.md5(sign_str_o.encode(encoding="utf-8")).hexdigest().upper() return str(time_str), sign_str class tem(): ZCTW = None ZCTJSJ = None ZWTW = None ZWTJSJ = None WSTW = None WSTJSJ = None tb_now = None flag = True def __init__(self): self.header1 = { 'origin': 'https://wxyqfk.zhxy.net', 'referer': 'https://wxyqfk.zhxy.net/?yxdm=12345', 'sign': getAttrs()[1], 'timestamp': getAttrs()[0], 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 Edg/85.0.564.68' } self.check() tem_list = ['36.{}'.format(i) for i in range(2, 8)] if self.ZCTW == None: self.ZCTJSJ = self.tb_now self.ZCTW = random.choice(tem_list) else: if self.ZWTW == None: self.ZWTJSJ = self.ZCTJSJ = self.tb_now self.ZWTW = random.choice(tem_list) else: if self.WSTW == None: self.WSTJSJ = self.ZWTJSJ = self.ZCTJSJ = self.tb_now self.WSTW = random.choice(tem_list) else: print("已全部填写!") self.flag = False # 用于判断是否继续填写温度 def check(self): self.now = datetime.datetime.now() params = { 'uid': USRID, 'usertype': 1, 'yxdm': '12345', 'date': self.now.strftime("%Y-%m-%d") } r1 = requests.get('https://yqfkapi.zhxy.net/api/ClockIn/gettem', params=params, headers=self.header1) try: self.ID = r1.json()['data']['ID'] self.ZCTW = r1.json()['data']['ZCTW'] self.ZWTW = r1.json()['data']['ZWTW'] self.WSTW = r1.json()['data']['WSTW'] self.tb_now = self.now.strftime("%Y-%m-%d %H:%M:%S") print('已填报信息获取成功!') self.first_flag=False except: self.first_flag=True def tem_action(self): if self.flag: if self.first_flag: self.json2 = { 'UID': USRID, 'UType': 1, 'YXDM': "12345", 'ZCTJSJ': self.ZCTJSJ, 'ZCTW': self.ZCTW, } else: self.json2 = { 'ID': self.ID, 'SBRQ': self.now.strftime("%Y-%m-%d") + " 00:00:00", 'UID': USRID, 'UType': 1, 'YXDM': "12345", 'ZCTJSJ': self.ZCTJSJ, 'ZCTW': self.ZCTW, 'ZWTJSJ': self.ZWTJSJ, 'ZWTW': self.ZWTW, 'WSTJSJ': self.WSTJSJ, 'WSTW': self.WSTW } # 体温填报 ses = requests.session() a=int(USRID) self.json2['UID']=a r1 = ses.post('https://yqfkapi.zhxy.net/api/ClockIn/SaveTem', headers=self.header1, json=self.json2).json() try: print("体温填写通知:\n每日体温已填报({})\n早晨:{}\n中午:{}\n晚上:{}".format(self.now.strftime("%Y-%m-%d"), r1['data']['ZCTW'], r1['data']['ZWTW'], r1['data']['WSTW'])) #msg("体温填写通知:\n每日体温已填报({})\n早晨:{}\n中午:{}\n晚上:{}".format(self.now.strftime("%Y-%m-%d"), r1['data']['ZCTW'], r1['data']['ZWTW'], r1['data']['WSTW'])) except: print(r1) while(USRID<=888888): USRID=USRID+1; print("当前正在进行:"+str(USRID)) tem().tem_action()
获取ID号
def getid(): headero = { 'origin': 'https://wxyqfk.zhxy.net', 'referer': 'https://wxyqfk.zhxy.net/?yxdm=12345', 'sign': getAttrs()[1], 'timestamp': getAttrs()[0], 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36 Edg/85.0.564.68' } jsonusr = { 'YXDM': "12345", 'UserType': 1, 'XGH': USRXH, 'Name': USRNAME, 'PassWord': USRPSW, } seso = requests.session() usr = seso.post('https://yqfkapi.zhxy.net/api/User/CheckUser', headers=headero, json=jsonusr).json() #print(self.jsonusr) #print(usr) try: USRID=usr['data']['ID'] tem().tem_action() except: print(USRID)