Skip to content

Commit

Permalink
fix(download.py): accommodate missing gh api response item
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Oct 2, 2024
1 parent 1883647 commit 74d1afd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modflow_devtools/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ def get_release(repo, tag="latest", retries=3, verbose=False) -> dict:
try:
with urllib.request.urlopen(request, timeout=10) as resp:
result = resp.read()
remaining = int(resp.headers["x-ratelimit-remaining"])
if remaining <= 10:
remaining = resp.headers.get("x-ratelimit-remaining", None)
if remaining and int(remaining) <= 10:
warn(
f"Only {remaining} GitHub API requests remaining "
"before rate-limiting"
Expand Down

0 comments on commit 74d1afd

Please sign in to comment.