retry when invalid file

This commit is contained in:
Cyberes 2023-11-04 20:13:12 -06:00
parent 1ec0630b6e
commit 3ff29d678c
1 changed files with 4 additions and 3 deletions

View File

@ -21,10 +21,11 @@ def download_tile(task):
output_path: Path = output / f"{row}_{col}.png"
if output_path.exists():
if not is_png(output_path):
# Delete the file and try again later.
# Delete the file and try again.
del_path(output_path)
return row, col, 'failure'
return row, col, 'exist'
# return row, col, 'failure'
else:
return row, col, 'exist'
tile_url = f"{base_url}/{row}/{col}"
response = requests.get(tile_url, headers=r_headers, proxies=PROXIES if use_proxy else None, timeout=60)
if response.status_code == 200: