From 3811fd8a25336b9a36261722e537ff1dca319093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 5 Jan 2020 00:47:10 +0100 Subject: [PATCH] fix time formatting for Python 3.4 and 3.5 'datetime.time.isoformat()' only has an optional 'timespec' argument since Python 3.6. --- gallery_dl/extractor/common.py | 3 ++- gallery_dl/extractor/tumblr.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/common.py b/gallery_dl/extractor/common.py index 44e062fc..380bcc70 100644 --- a/gallery_dl/extractor/common.py +++ b/gallery_dl/extractor/common.py @@ -135,7 +135,8 @@ class Extractor(): raise ValueError("Either 'seconds' or 'until' is required") if reason: - isotime = until.time().isoformat("seconds") + t = until.time() + isotime = "{:02}:{:02}:{:02}".format(t.hour, t.minute, t.second) self.log.info("Waiting until %s for %s.", isotime, reason) time.sleep(seconds + adjust) diff --git a/gallery_dl/extractor/tumblr.py b/gallery_dl/extractor/tumblr.py index 425d96ab..a1f21997 100644 --- a/gallery_dl/extractor/tumblr.py +++ b/gallery_dl/extractor/tumblr.py @@ -407,11 +407,12 @@ class TumblrAPI(oauth.OAuth1API): # daily rate limit if response.headers.get("x-ratelimit-perday-remaining") == "0": reset = response.headers.get("x-ratelimit-perday-reset") - until = datetime.now() + timedelta(seconds=float(reset)) + t = (datetime.now() + timedelta(seconds=float(reset))).time() + self.log.error("Daily API rate limit exceeded") raise exception.StopExtraction( "Aborting - Rate limit will reset at %s", - until.time().isoformat("seconds")) + "{:02}:{:02}:{:02}".format(t.hour, t.minute, t.second)) # hourly rate limit reset = response.headers.get("x-ratelimit-perhour-reset")