Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pythonbuild/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,14 @@ def download_to_path(url: str, path: pathlib.Path, size: int, sha256: str):
print(f"HTTP exception on {url}; retrying: {e}")
time.sleep(2**attempt)
except urllib.error.URLError as e:
print(f"urllib error on {url}; retrying: {e}")
time.sleep(2**attempt)
if e.errno in {403, 429}:
print(f"possible rate limit error on {url}; retrying: {e}")
time.sleep(2 ** (attempt + 2))
else:
print(f"urllib error on {url}; retrying: {e}")
time.sleep(2**attempt)
else:
raise Exception("download failed after multiple retries: %s" % url)
raise Exception(f"download failed after {attempt} retries: {url}")

tmp.rename(path)
print("successfully downloaded %s" % url)
Expand Down
Loading