fix
This commit is contained in:
parent
8276619657
commit
ec89cb7a01
@ -25,18 +25,23 @@ class htmlUtils:
|
||||
count = 1
|
||||
#数据为空则获取数据
|
||||
while url_text == None:
|
||||
try:
|
||||
print("请求地址:",curl)
|
||||
res = s.get(curl,stream=True, headers=cls.headers, timeout=50)
|
||||
if type == "bytes":
|
||||
url_text = res
|
||||
else:
|
||||
url_text = html.fromstring(res.text)
|
||||
except:
|
||||
print(f'Retry! 第{count}次')
|
||||
time.sleep(3)
|
||||
traceback.print_exc()
|
||||
continue
|
||||
if count <= 10:
|
||||
try:
|
||||
print("请求地址:",curl)
|
||||
res = s.get(curl,stream=True, headers=cls.headers, timeout=50)
|
||||
if type == "bytes":
|
||||
url_text = res
|
||||
else:
|
||||
url_text = html.fromstring(res.text)
|
||||
except:
|
||||
print(f'Retry! 第{count}次')
|
||||
time.sleep(3)
|
||||
traceback.print_exc()
|
||||
count += 1
|
||||
continue
|
||||
else:
|
||||
print(f"fail 请求失败:{curl}")
|
||||
break
|
||||
if type == "None":
|
||||
data = { curl : url_text}
|
||||
cls.url_data.update(data)
|
||||
@ -49,7 +54,7 @@ class htmlUtils:
|
||||
@classmethod
|
||||
def getJSON(cls,curl):
|
||||
count = 0
|
||||
while count <= 5:
|
||||
while count < 5:
|
||||
try:
|
||||
res = requests.get(curl, headers=cls.headers,timeout=50)
|
||||
data_json = res.json()
|
||||
|
||||
@ -5,7 +5,6 @@ from utils.ImageUtils import imageUtils
|
||||
from utils.comic.ComicInfo import comicInfo
|
||||
from utils.CBZUtils import CBZUtils
|
||||
from utils.downloader import download_images
|
||||
from utils.entity.BaseComicEntity import baseComic
|
||||
|
||||
class comicEntity:
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user