set min timeout

This commit is contained in:
caiwx86 2023-03-30 13:19:23 +08:00
parent e8563a2826
commit 7504cf89d4
3 changed files with 3 additions and 3 deletions

View File

@ -73,7 +73,7 @@ class htmlUtils:
if count <= 5: if count <= 5:
try: try:
print(f"请求地址:{curl}") print(f"请求地址:{curl}")
res = s.get(curl,stream=True, headers=cls.headers, timeout=180,allow_redirects=True) res = s.get(curl,stream=True, headers=cls.headers, timeout=10,allow_redirects=True)
if res.status_code != 200: if res.status_code != 200:
cls.remove_HtmlCache(curl) cls.remove_HtmlCache(curl)
return None return None

View File

@ -128,7 +128,7 @@ class baseComic:
repeat = 1 repeat = 1
while is_next and repeat <= 2 and not CBZUtils.updateOldCBZ(files_name): while is_next and repeat <= 2 and not CBZUtils.updateOldCBZ(files_name):
ntfy.sendMsg(f"{book_name} {chapter_name} 下载中") ntfy.sendMsg(f"{book_name} {chapter_name} 下载中")
download_images(list_img,ci.getDirComicChapter(), files_name=files_name,concurrency=10,timeout=60) download_images(list_img,ci.getDirComicChapter(), files_name=files_name,concurrency=10,timeout=20)
equ_next = len(",".join(os.listdir(ci.getDirComicChapter())).split(".jpg"))-1 == len(list_img) equ_next = len(",".join(os.listdir(ci.getDirComicChapter())).split(".jpg"))-1 == len(list_img)
if not equ_next: if not equ_next:
sleep_time = 3+int(repeat)*2 sleep_time = 3+int(repeat)*2

View File

@ -68,7 +68,7 @@ def download_image(image_url, dst_dir, file_name, timeout=20, proxy_type=None, p
print("## Fail: {} {}".format(image_url, e.args)) print("## Fail: {} {}".format(image_url, e.args))
def download_images(image_urls, dst_dir,concurrency=None,timeout=30,proxy_type=None, proxy=None,files_name=None): def download_images(image_urls, dst_dir,concurrency=None,timeout=20,proxy_type=None, proxy=None,files_name=None):
""" """
Download image according to given urls and automatically rename them in order. Download image according to given urls and automatically rename them in order.
:param timeout: :param timeout: