Skip to content

Commit

Permalink
fix(get_modflow): accommodate missing ratelimit info on api response (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli authored Oct 1, 2024
1 parent 49c508c commit 3818033
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flopy/utils/get_modflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ def get_release(owner=None, repo=None, tag="latest", quiet=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:
warnings.warn(
f"Only {remaining} GitHub API requests remaining "
"before rate-limiting"
Expand Down

0 comments on commit 3818033

Please sign in to comment.