Compare commits
No commits in common. "master" and "master" have entirely different histories.
22
main.py
22
main.py
|
|
@ -1,5 +1,3 @@
|
||||||
from logging import error
|
|
||||||
from traceback import print_tb
|
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
@ -213,11 +211,9 @@ class HealthCheckInHelper(ZJULogin):
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
print('验证码识别失败')
|
print('验证码识别失败')
|
||||||
raise Exception("验证码识别失败")
|
|
||||||
except:
|
except:
|
||||||
print('发生异常')
|
print('打卡网页获取失败')
|
||||||
raise Exception("发生异常")
|
finally:
|
||||||
|
|
||||||
new_info_tmp = json.loads(re.findall(r'def = ({[^\n]+})', html)[0])
|
new_info_tmp = json.loads(re.findall(r'def = ({[^\n]+})', html)[0])
|
||||||
new_id = new_info_tmp['id']
|
new_id = new_info_tmp['id']
|
||||||
new_uid = new_info_tmp['uid']
|
new_uid = new_info_tmp['uid']
|
||||||
|
|
@ -355,11 +351,6 @@ class HealthCheckInHelper(ZJULogin):
|
||||||
if self.delay_run:
|
if self.delay_run:
|
||||||
# 确保定时脚本执行时间不太一致
|
# 确保定时脚本执行时间不太一致
|
||||||
time.sleep(random.randint(10, 100))
|
time.sleep(random.randint(10, 100))
|
||||||
try_count=0
|
|
||||||
while True:
|
|
||||||
if try_count>10:
|
|
||||||
print("已经尝试你妈的10次了,还不对,你退群吧")
|
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
self.login()
|
self.login()
|
||||||
# 拿取eai-sess的cookies信息
|
# 拿取eai-sess的cookies信息
|
||||||
|
|
@ -372,16 +363,9 @@ class HealthCheckInHelper(ZJULogin):
|
||||||
# print(geo_info)
|
# print(geo_info)
|
||||||
res = self.take_in(geo_info)
|
res = self.take_in(geo_info)
|
||||||
print(res)
|
print(res)
|
||||||
return
|
|
||||||
except requests.exceptions.ConnectionError:
|
except requests.exceptions.ConnectionError:
|
||||||
# reraise as KubeException, but log stacktrace.
|
# reraise as KubeException, but log stacktrace.
|
||||||
print("打卡失败,请检查服务器网络状态")
|
print("打卡失败,请检查github服务器网络状态")
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
print("遇到错误,尝试重试")
|
|
||||||
print("重试中...",try_count)
|
|
||||||
try_count+=1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue