From 5f27cfeff622ed6f75fbddda0aa74e6ceaf3a789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Thu, 26 Jul 2018 19:43:46 +0200 Subject: [PATCH] [deviantart] remove `prefer-public` option All API requests now always use a public token and only switch to a private token for pagination results if `refresh-token` is set and less deviations than requested were returned. --- docs/configuration.rst | 17 ----------------- docs/gallery-dl.conf | 1 - gallery_dl/extractor/deviantart.py | 6 ++---- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index 95241bc7..a2602fc7 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -333,23 +333,6 @@ Description Download full-sized original images if available. =========== ===== -extractor.deviantart.prefer-public ----------------------------------- -=========== ===== -Type ``bool`` -Default ``false`` -Description Call API endpoints with a public access token first - and only switch to a private access token if deviations are missing - (i.e. they are only visible to logged in users). - - This option only has an effect when using a `refresh token`__ - and tries to minimize the amount of API calls with private access - tokens, as they have a much lower rate limit than public ones. - - __ extractor.deviantart.refresh-token_ -=========== ===== - - extractor.deviantart.refresh-token ---------------------------------- =========== ===== diff --git a/docs/gallery-dl.conf b/docs/gallery-dl.conf index 2ff80222..2cf2868c 100644 --- a/docs/gallery-dl.conf +++ b/docs/gallery-dl.conf @@ -17,7 +17,6 @@ "deviantart": { "refresh-token": null, - "prefer-public": false, "flat": true, "journals": "html", "mature": true, diff --git a/gallery_dl/extractor/deviantart.py b/gallery_dl/extractor/deviantart.py index 33f66b89..f48870fb 100644 --- a/gallery_dl/extractor/deviantart.py +++ b/gallery_dl/extractor/deviantart.py @@ -461,7 +461,6 @@ class DeviantartAPI(): if not isinstance(self.mature, str): self.mature = "true" if self.mature else "false" - self.prefer_public = extractor.config("prefer-public", False) self.refresh_token = extractor.config("refresh-token") self.client_id = extractor.config("client-id", self.CLIENT_ID) self.client_secret = extractor.config( @@ -604,7 +603,7 @@ class DeviantartAPI(): self.log.warning("%s. Using %ds delay.", msg, 2 ** self.delay) def _pagination(self, endpoint, params): - public = self.prefer_public + public = True while True: data = self._call(endpoint, params, public=public) if "results" not in data: @@ -612,13 +611,12 @@ class DeviantartAPI(): return if (public and self.refresh_token and len(data["results"]) < params["limit"]): - self.log.debug("Repeating API call with private access token") + self.log.debug("Switching to private access token") public = False continue yield from data["results"] if not data["has_more"]: return - public = self.prefer_public params["offset"] = data["next_offset"] def _pagination_list(self, endpoint, params):