From 7b4b364bebaee6f253e4b69ec1abaf32eca89054 Mon Sep 17 00:00:00 2001 From: RGBCube <78925721+RGBCube@users.noreply.github.com> Date: Mon, 27 Jun 2022 13:16:44 +0300 Subject: [PATCH] Fix ratelimits not getting updated when the request is successful --- github/internals/http.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/github/internals/http.py b/github/internals/http.py index 9d048f9..d181a93 100644 --- a/github/internals/http.py +++ b/github/internals/http.py @@ -174,8 +174,6 @@ class HTTPClient: async with self.__session.request( method, f"https://api.github.com{path}", **kwargs ) as request: - if 200 <= request.status <= 299: - return await request.json() headers = request.headers @@ -189,6 +187,9 @@ class HTTPClient: datetime.now(timezone.utc), ) + if 200 <= request.status <= 299: + return await request.json() + raise error_from_request(request) # === ROUTES === #