From 4f8b55ea4a66d0dc5896872ccbe84d6e6cff4726 Mon Sep 17 00:00:00 2001 From: Alex Boden Date: Thu, 28 Nov 2024 20:47:43 -0500 Subject: [PATCH] Update main.py to ensure x-ratelimit is in headers --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 4aed4f4..a1eb1c7 100644 --- a/main.py +++ b/main.py @@ -60,8 +60,10 @@ def get_gh_api(url, token, etag=None): headers['If-None-Match'] = etag response = requests.get(url, headers=headers) - if int(response.headers['X-RateLimit-Remaining']) % 100 == 0: - logger.info(f"Rate Limit Remaining: {response.headers['X-RateLimit-Remaining']}") + if 'X-RateLimit-Remaining' in response.headers: + if int(response.headers['X-RateLimit-Remaining']) % 100 == 0: + logger.info(f"Rate Limit Remaining: {response.headers['X-RateLimit-Remaining']}") + if response.status_code == 304: return None, etag elif response.status_code == 200: