This commit is contained in:
caiwx86 2023-04-01 14:06:14 +08:00
parent bbb86fda72
commit c489085ce1

View File

@ -63,9 +63,12 @@ class htmlUtils:
except: url_text = None
if url_text != None and update == False: return html.fromstring(url_text)
else: url_text = None
while url_text == None:
repeat = 0
while url_text == None and repeat <=5:
repeat+=1
print(f"请求地址:{curl}")
res = s.get(curl,stream=True, headers=cls.headers, timeout=5,allow_redirects=True)
try: res = s.get(curl,stream=True, headers=cls.headers, timeout=5,allow_redirects=True)
except: print(f"请求失败:{curl}")
if type == "bytes":
url_text = res
if type == "json":