[deviantart] keep using private access tokens

for deviations returned from a private API call

also fixes a bug from 0a7eee3e where '_pagination()'
would never switch from unspecified (None) to private access token
This commit is contained in:
Mike Fährmann
2023-04-13 14:20:43 +02:00
parent e70af6a550
commit e9353c63d6

View File

@@ -1569,6 +1569,11 @@ class DeviantartOAuthAPI():
def _pagination(self, endpoint, params,
extend=True, public=None, unpack=False, key="results"):
warn = True
if public is None:
public = self.public
elif not public:
self.public = False
while True:
data = self._call(endpoint, params=params, public=public)
if key not in data:
@@ -1583,7 +1588,7 @@ class DeviantartOAuthAPI():
if public and len(results) < params["limit"]:
if self.refresh_token_key:
self.log.debug("Switching to private access token")
public = False
self.public = public = False
continue
elif data["has_more"] and warn:
warn = False