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

@@ -418,7 +418,7 @@ class TumblrAPI(oauth.OAuth1API):
reset = response.headers.get("x-ratelimit-perhour-reset")
if reset:
self.log.info("Hourly API rate limit exceeded")
self.extractor.wait(seconds=reset, reason="rate limit reset")
self.extractor.wait(seconds=reset)
return self._call(blog, endpoint, params)
raise exception.StopExtraction(data)