[twitter] handle 429 responses without x-rate-limit-reset header

This commit is contained in:
Mike Fährmann
2020-07-23 22:38:17 +02:00
parent d2e17e16bf
commit 8f64585ff2

View File

@@ -503,8 +503,9 @@ class TwitterAPI():
if response.status_code < 400:
return response.json()
if response.status_code == 429:
self.extractor.wait(until=response.headers["x-rate-limit-reset"])
return self._call(endpoint, params)
until = response.headers.get("x-rate-limit-reset")
self.extractor.wait(until=until, seconds=(None if until else 60))
return self._call(endpoint, params, method)
try:
msg = ", ".join(