From 4ee9975e8f3551d418ebfc0911263ed7ea2fd558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20Egemen?= Date: Fri, 28 Feb 2025 22:33:48 +0100 Subject: [PATCH 1/2] Updated http.py to have a less strict content type check. Top.GG API no longer returns "charset=utf-8" --- topgg/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topgg/http.py b/topgg/http.py index 08160d67..d08e7da4 100644 --- a/topgg/http.py +++ b/topgg/http.py @@ -44,7 +44,7 @@ async def _json_or_text( response: ClientResponse, ) -> Union[dict, str]: text = await response.text() - if response.headers["Content-Type"] == "application/json; charset=utf-8": + if "application/json" in response.headers["Content-Type"]:: return json.loads(text) return text From aab0f3bf207dec64b043e5eceb4baf0ea5a9aaa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20Egemen?= Date: Fri, 28 Feb 2025 22:35:23 +0100 Subject: [PATCH 2/2] Fixed syntax typo --- topgg/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topgg/http.py b/topgg/http.py index d08e7da4..897bba2f 100644 --- a/topgg/http.py +++ b/topgg/http.py @@ -44,7 +44,7 @@ async def _json_or_text( response: ClientResponse, ) -> Union[dict, str]: text = await response.text() - if "application/json" in response.headers["Content-Type"]:: + if "application/json" in response.headers["Content-Type"]: return json.loads(text) return text