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