From 25a04ed1351e5c5d463574ec05af841c36b1519c Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 1 Feb 2020 23:46:28 -0500 Subject: [PATCH] Better detection for Cloudflare related 429s. At some point Cloudflare started returning some JSON. I don't know how this JSON looks like. See #2544 --- discord/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/http.py b/discord/http.py index 6a7b757e..1eeff4d2 100644 --- a/discord/http.py +++ b/discord/http.py @@ -179,7 +179,7 @@ class HTTPClient: # we are being rate limited if r.status == 429: - if not isinstance(data, dict): + if not r.headers.get('Via'): # Banned by Cloudflare more than likely. raise HTTPException(r, data)