improve Extractor.wait()

- allow 'until' to be a datetime object
- do "time calculations" with UTC timestamps
- set a default 'reason'
This commit is contained in:
Mike Fährmann
2020-04-05 21:23:05 +02:00
parent 5d7404ab58
commit d02f7c1118
5 changed files with 21 additions and 13 deletions

View File

@@ -224,8 +224,7 @@ class TwitterExtractor(Extractor):
if response.status_code == 429 or \
response.headers.get("x-rate-limit-remaining") == "0":
if self.logged_in:
reset = response.headers.get("x-rate-limit-reset")
self.wait(until=reset, reason="rate limit reset")
self.wait(until=response.headers.get("x-rate-limit-reset"))
else:
_guest_token.invalidate()
return self._video_from_tweet(tweet_id)