diff --git a/lib/utils.py b/lib/utils.py index 260a980..aeebc0d 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -35,7 +35,7 @@ def connection(username,password): except: return ('账号或密码错误', 422) r = s.get(url='http://mysso-cust-edu-cn-s.webvpn.cust.edu.cn:8118/cas/login?service=http://'+ip[0]+'.'+ip[1]+'.'+ip[2]+'.'+ip[3]+':8080/welcome',allow_redirects=False) - ticket = r.headers['Location'][68:] + ticket = r.headers['Location'][72:] asp_net_sessionid_param = {'Ticket':ticket,'Url':'http://'+ip[0]+'.'+ip[1]+'.'+ip[2]+'.'+ip[3]+':8080/welcome'} asp_net_sessionid_param = base64.b64encode(quote(json.dumps(asp_net_sessionid_param)).encode('utf-8')).decode('utf-8') asp_net_sessionid_param = {'param':asp_net_sessionid_param} @@ -61,7 +61,7 @@ def signCode(code): # 生成唯一不重名字符串 def randomId(): nowTime = datetime.datetime.now().strftime("%Y%m%d%H%M%S") # 生成当前时间 - randomNum = random.randint(0, 100) # 生成的随机整数n,其中0<=n<=100 + randomNum = random.randint(0, 99) # 生成的随机整数n,其中0<=n<=100 if randomNum <= 10: randomNum = str(0) + str(randomNum) uniqueNum = str(nowTime) + str(randomNum)