赞
踩
import requests import time def login(): url = "http://seat.hhit.edu.cn/ClientWeb/pro/ajax/login.aspx" querystring = {"act": "login", "id": "**********", "pwd": "**********", "role": "512", "aliuserid": "", "schoolcode": "", "wxuserid": "", "_nocache": "1553744928029%0A"} payload = "" headers = { 'cache-control': "no-cache", 'Postman-Token': "d0b36b6b-72c4-45b0-b283-4a4c3600bdec" } response = requests.request("GET", url, data=payload, headers=headers, params=querystring) print(response.text) def library(dev_id,start_time,end_time,Cookie): url = "http://seat.hhit.edu.cn/ClientWeb/pro/ajax/reserve.aspx" querystring = {"dev_id": dev_id, "lab_id": "100455340", "room_id": "", "kind_id": "100455550", "type": "dev", "prop": "", "test_id": "", "resv_id": "", "term": "", "min_user": "", "max_user": "", "mb_list": "", "test_name": "", "start": start_time, "end": end_time, "memo": "", "act": "set_resv", "_nocache": "1553744312558%0A"} payload = "" headers = { 'Cookie': Cookie, 'cache-control': "no-cache", 'Postman-Token': "f336ab0c-58f8-4089-935b-bd35ad9fb519" } response = requests.request("GET", url, data=payload, headers=headers, params=querystring) print(response.json()['msg']) return response.json()['msg'] def unix_time(dt): # 转换成时间数组 timeArray = time.strptime(dt, "%Y-%m-%d %H:%M:%S") # 转换成时间戳 timestamp = int(time.mktime(timeArray)) return timestamp if __name__=="__main__": print("请输入抢课时间,格式如:2019-03-28 14:40:00") t=input() print("请输入开始时间,格式如:2019-03-28 14:40") start_time=input() print("请输入结束时间,格式如:2019-03-28 15:40") end_time=input() t = unix_time(t)-int(time.time()) print("需睡眠"+str(t)+"秒") time.sleep(t) dev_id=100455677 Cookie=login() while True: #2019-04-03 14:40 a=library(dev_id,start_time,end_time,Cookie) if a=="操作成功!": print("抢座成功") break print("抢座中") dev_id+=1 if dev_id==100455745: dev_id=100455677 time.sleep(1)
欢迎各位评论,看见会一一回复,一起共同进步
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。