fix
This commit is contained in:
parent
9105f9088e
commit
c289851cc5
@ -180,6 +180,7 @@ class downloadUtils:
|
|||||||
return None
|
return None
|
||||||
temp_path = os.path.join(dst_dir, file_name+".downloads")
|
temp_path = os.path.join(dst_dir, file_name+".downloads")
|
||||||
repair_count = 1
|
repair_count = 1
|
||||||
|
try:
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
image_url, headers=cls.headers, timeout=timeout, proxies=proxies)
|
image_url, headers=cls.headers, timeout=timeout, proxies=proxies)
|
||||||
while response.status_code != 200 and repair_count <= 5:
|
while response.status_code != 200 and repair_count <= 5:
|
||||||
@ -191,6 +192,9 @@ class downloadUtils:
|
|||||||
with open(temp_path, 'wb') as f:
|
with open(temp_path, 'wb') as f:
|
||||||
f.write(response.content)
|
f.write(response.content)
|
||||||
response.close()
|
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"):
|
if fu.ver_file(temp_path,type="image"):
|
||||||
shutil.move(temp_path, file_path)
|
shutil.move(temp_path, file_path)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user