Skip to content

Commit 3818033

Browse files
authored
fix(get_modflow): accommodate missing ratelimit info on api response (#2320)
1 parent 49c508c commit 3818033

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

flopy/utils/get_modflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def get_release(owner=None, repo=None, tag="latest", quiet=False) -> dict:
160160
try:
161161
with urllib.request.urlopen(request, timeout=10) as resp:
162162
result = resp.read()
163-
remaining = int(resp.headers["x-ratelimit-remaining"])
164-
if remaining <= 10:
163+
remaining = resp.headers.get("x-ratelimit-remaining", None)
164+
if remaining and int(remaining) <= 10:
165165
warnings.warn(
166166
f"Only {remaining} GitHub API requests remaining "
167167
"before rate-limiting"

0 commit comments

Comments
 (0)