Delete file on failure in Requests and Curl-Impersonate downloaders

This commit is contained in:
rlaphoenix 2024-01-23 09:46:24 +00:00
parent ba93c78b99
commit 5e858e1259
2 changed files with 2 additions and 0 deletions

View File

@ -96,6 +96,7 @@ def curl_impersonate(
download_sizes.clear()
break
except Exception as e:
out_path.unlink(missing_ok=True)
if DOWNLOAD_CANCELLED.is_set() or attempts == MAX_ATTEMPTS:
raise e
time.sleep(RETRY_WAIT)

View File

@ -98,6 +98,7 @@ def requests(
download_sizes.clear()
break
except Exception as e:
out_path.unlink(missing_ok=True)
if DOWNLOAD_CANCELLED.is_set() or attempts == MAX_ATTEMPTS:
raise e
time.sleep(RETRY_WAIT)