ignore file download if 404 not found

This commit is contained in:
ytshen 2024-12-26 23:06:08 +08:00
parent 8302339932
commit fe63c823e3

View File

@ -25,6 +25,7 @@ def download_xpi(xpi_url: str, download_dir: str, unique_name: str, force_downlo
return download_filepath
response = requests.get(xpi_url, stream=True)
if response.status_code == 200:
print(f'download {unique_name} from {xpi_url}')
with open(download_filepath, "wb") as file:
for chunk in response.iter_content(chunk_size=1024):