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
This commit is contained in:
Rapptz 2020-02-01 23:46:28 -05:00
parent 3b8678da81
commit 25a04ed135

View File

@ -179,7 +179,7 @@ class HTTPClient:
# we are being rate limited # we are being rate limited
if r.status == 429: if r.status == 429:
if not isinstance(data, dict): if not r.headers.get('Via'):
# Banned by Cloudflare more than likely. # Banned by Cloudflare more than likely.
raise HTTPException(r, data) raise HTTPException(r, data)