From 26cbcb3a72f1df7cd1907538171eb7c1814c1d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 17 Sep 2018 10:10:32 +0200 Subject: [PATCH] [flickr] improve error handling (#109) --- gallery_dl/extractor/flickr.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gallery_dl/extractor/flickr.py b/gallery_dl/extractor/flickr.py index cea46b1d..00c7a925 100644 --- a/gallery_dl/extractor/flickr.py +++ b/gallery_dl/extractor/flickr.py @@ -368,8 +368,15 @@ class FlickrAPI(oauth.OAuth1API): if self.api_key: params["api_key"] = self.api_key data = self.session.get(self.API_URL, params=params).json() - if "code" in data and data["code"] == 1: - raise exception.NotFoundError(self.subcategory) + if "code" in data: + if data["code"] == 1: + raise exception.NotFoundError(self.subcategory) + elif data["code"] == 98: + raise exception.AuthenticationError(data.get("message")) + elif data["code"] == 99: + raise exception.AuthorizationError() + self.log.error("API call failed: %s", data.get("message")) + raise exception.StopExtraction() return data def _pagination(self, method, params):