From 74d1afdd07fe0bfb3fcc148fdb036cab6890c0eb Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Wed, 2 Oct 2024 11:20:17 -0400 Subject: [PATCH] fix(download.py): accommodate missing gh api response item --- modflow_devtools/download.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modflow_devtools/download.py b/modflow_devtools/download.py index 4c2b67e..475bc06 100644 --- a/modflow_devtools/download.py +++ b/modflow_devtools/download.py @@ -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"