From 078321ee5154c9100eebe03f95c42314a3e25d0e Mon Sep 17 00:00:00 2001 From: KjeldP <8656230+Kjeld-P@users.noreply.github.com> Date: Mon, 25 Dec 2023 11:46:26 +0900 Subject: [PATCH 1/2] Fix rate-limit bug Check if rate_limit is a valid object rather than evaluating it as a bool when deciding whether to raise a RateLimit exception or not, --- gidgethub/sansio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gidgethub/sansio.py b/gidgethub/sansio.py index a3bc964..c27e2c1 100644 --- a/gidgethub/sansio.py +++ b/gidgethub/sansio.py @@ -339,7 +339,7 @@ def decipher_response( exc_type = BadRequest if status_code == 403: rate_limit = RateLimit.from_http(headers) - if rate_limit and not rate_limit.remaining: + if rate_limit != None and not rate_limit.remaining: raise RateLimitExceeded(rate_limit, message) elif status_code == 422: try: From fa0fbf53a3d27b6e4b1c189aa86a92b5ea5ddad6 Mon Sep 17 00:00:00 2001 From: KjeldP <8656230+Kjeld-P@users.noreply.github.com> Date: Fri, 5 Jan 2024 07:47:21 +0900 Subject: [PATCH 2/2] Update gidgethub/sansio.py Co-authored-by: Brett Cannon --- gidgethub/sansio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gidgethub/sansio.py b/gidgethub/sansio.py index c27e2c1..24ed271 100644 --- a/gidgethub/sansio.py +++ b/gidgethub/sansio.py @@ -339,7 +339,7 @@ def decipher_response( exc_type = BadRequest if status_code == 403: rate_limit = RateLimit.from_http(headers) - if rate_limit != None and not rate_limit.remaining: + if rate_limit is not None and not rate_limit.remaining: raise RateLimitExceeded(rate_limit, message) elif status_code == 422: try: