aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2020-02-01 23:46:28 -0500
committerRapptz <[email protected]>2020-02-01 23:46:28 -0500
commit25a04ed1351e5c5d463574ec05af841c36b1519c (patch)
tree7979725a0144c29c3d7790fb5b439ac844494da1
parentUse member data from VOICE_STATE_UPDATE if not found in cache (diff)
downloaddiscord.py-25a04ed1351e5c5d463574ec05af841c36b1519c.tar.xz
discord.py-25a04ed1351e5c5d463574ec05af841c36b1519c.zip
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
-rw-r--r--discord/http.py2
1 files changed, 1 insertions, 1 deletions
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)