Random sleep

This commit is contained in:
Pesy Wu 2024-01-30 16:18:43 +08:00 committed by GitHub
parent 37cb1e8bdb
commit cb9483c9f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,10 +5,7 @@ import re
import sentry_sdk import sentry_sdk
import random import random
import time import time
import os
import yaml import yaml
from pprint import pprint
def ReadConf(variable_name, default_value=None): def ReadConf(variable_name, default_value=None):
# Try to get the variable from the environment # Try to get the variable from the environment
@ -99,9 +96,9 @@ if __name__ == '__main__':
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0' 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0'
} }
bbsid = re.findall(r'oi=[0-9]+', token)[0].replace('oi=', '') bbsid = re.findall(r'oi=[0-9]+', token)[0].replace('oi=', '')
# wait_time = random.randint(1, 3600) # Random Sleep to Avoid Ban wait_time = random.randint(1, 3600) # Random Sleep to Avoid Ban
# print(f'为了避免同一时间签到人数太多导致被官方怀疑,开始休眠 {wait_time} 秒') print(f'为了避免同一时间签到人数太多导致被官方怀疑,开始休眠 {wait_time}')
# time.sleep(wait_time) time.sleep(wait_time)
wallet = r.get(WalletURL, headers=headers, timeout=60) wallet = r.get(WalletURL, headers=headers, timeout=60)
if json.loads(wallet.text) == {"data": None,"message":"登录已失效,请重新登录","retcode":-100}: if json.loads(wallet.text) == {"data": None,"message":"登录已失效,请重新登录","retcode":-100}:
print(f'当前登录已过期,请重新登陆!返回为:{wallet.text}') print(f'当前登录已过期,请重新登陆!返回为:{wallet.text}')