From 38180335445fa09f5463cf8b9239e6ed0c10bf5b Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Tue, 1 Oct 2024 17:48:09 -0400 Subject: [PATCH] fix(get_modflow): accommodate missing ratelimit info on api response (#2320) --- flopy/utils/get_modflow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flopy/utils/get_modflow.py b/flopy/utils/get_modflow.py index fae43b0632..6bc75ad4de 100755 --- a/flopy/utils/get_modflow.py +++ b/flopy/utils/get_modflow.py @@ -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"