This commit is contained in:
caiwx86 2023-04-05 14:12:25 +08:00
parent b6a2a17444
commit 7c821741d7

View File

@ -201,14 +201,15 @@ class downloadUtils:
@classmethod
def download_image(cls,timeout=20, proxy_type=None, proxy=None,type="image"):
repeat = 0
while not cls.down_queue.empty() and repeat <= 10:
while not cls.down_queue.empty() and repeat <= 15:
repeat += 1
data = cls.down_queue.get(False)
(file_name,image_url,dst_dir) = [data[0],data[1],data[2]]
if repeat > 1:
print(f"{repeat}次下载数据中... file_name={file_name}")
try:
cls.common_download(file_name,image_url,dst_dir)
cls.common_download(file_name,image_url,dst_dir,timeout=timeout,
proxy=proxy,proxy_type=proxy_type)
except:
print(f"下载重试中 {file_name}={image_url}")
cls.down_queue.put([file_name,image_url,dst_dir])