fix
This commit is contained in:
parent
0eea194268
commit
e0ad6a64d5
@ -53,19 +53,15 @@ class htmlUtils:
|
||||
|
||||
@classmethod
|
||||
def getJSON(cls,curl):
|
||||
count = 1
|
||||
data_json = None
|
||||
while count < 5:
|
||||
while True:
|
||||
try:
|
||||
res = requests.get(curl, headers=cls.headers,timeout=30)
|
||||
data_json = res.json()
|
||||
return data_json
|
||||
except:
|
||||
count += 1
|
||||
print(f"请求失败,第{count}次重试中...")
|
||||
print(f"请求失败,重试中...")
|
||||
time.sleep(1)
|
||||
res = requests.get(curl, headers=cls.headers,timeout=30)
|
||||
data_json = res.json()
|
||||
return data_json
|
||||
cls.getJSON(curl)
|
||||
|
||||
@classmethod
|
||||
def xpathData(cls,c_xpath,url=None,num=None,not_eq=None):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user