This commit is contained in:
caiwx86 2023-04-06 00:49:43 +08:00
parent 9105f9088e
commit c289851cc5

View File

@ -180,6 +180,7 @@ class downloadUtils:
return None
temp_path = os.path.join(dst_dir, file_name+".downloads")
repair_count = 1
try:
response = requests.get(
image_url, headers=cls.headers, timeout=timeout, proxies=proxies)
while response.status_code != 200 and repair_count <= 5:
@ -191,6 +192,9 @@ class downloadUtils:
with open(temp_path, 'wb') as f:
f.write(response.content)
response.close()
except Exception as e:
print(f"common_down() 出错了 {e}")
cls.down_queue.put([file_name,image_url,dst_dir])
#验证是否是图像
if fu.ver_file(temp_path,type="image"):
shutil.move(temp_path, file_path)