From 6ea3ff51730e185c515d36f602c1bf67437a58ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sun, 6 Mar 2022 16:24:39 +0100 Subject: [PATCH] [tumblr] notify users about registering an oauth application if they hit the daily rate limit and are using default API credentials --- gallery_dl/extractor/tumblr.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/tumblr.py b/gallery_dl/extractor/tumblr.py index 358bc954..fbe641db 100644 --- a/gallery_dl/extractor/tumblr.py +++ b/gallery_dl/extractor/tumblr.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2016-2020 Mike Fährmann +# Copyright 2016-2022 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -400,6 +400,15 @@ class TumblrAPI(oauth.OAuth1API): t = (datetime.now() + timedelta(seconds=float(reset))).time() self.log.error("Daily API rate limit exceeded") + + api_key = self.api_key or self.session.auth.consumer_key + if api_key == self.API_KEY: + self.log.info("Register your own OAuth application and " + "use its credentials to prevent this error: " + "https://github.com/mikf/gallery-dl/blob/mas" + "ter/docs/configuration.rst#extractortumblra" + "pi-key--api-secret") + raise exception.StopExtraction( "Aborting - Rate limit will reset at %s", "{:02}:{:02}:{:02}".format(t.hour, t.minute, t.second))