diff options
| author | 2022-08-29 02:17:16 -0400 | |
|---|---|---|
| committer | 2022-08-29 02:17:16 -0400 | |
| commit | a768930761f7f20587ae40a8cacca0e55c85290a (patch) | |
| tree | 5a4163db912b93fc45f717e5e43fd5be3e66f16c /gallery_dl/extractor/mastodon.py | |
| parent | ae2a0f5622beaa6f402526f8a7b939419283a090 (diff) | |
New upstream version 1.23.0.upstream/1.23.0
Diffstat (limited to 'gallery_dl/extractor/mastodon.py')
| -rw-r--r-- | gallery_dl/extractor/mastodon.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gallery_dl/extractor/mastodon.py b/gallery_dl/extractor/mastodon.py index 6e780e8..493a8ef 100644 --- a/gallery_dl/extractor/mastodon.py +++ b/gallery_dl/extractor/mastodon.py @@ -179,12 +179,11 @@ class MastodonAPI(): try: access_token = INSTANCES[extractor.category]["access-token"] except (KeyError, TypeError): - raise exception.StopExtraction( - "Missing access token.\n" - "Run 'gallery-dl oauth:mastodon:%s' to obtain one.", - extractor.instance) - - self.headers = {"Authorization": "Bearer " + access_token} + pass + if access_token: + self.headers = {"Authorization": "Bearer " + access_token} + else: + self.headers = None def account_id_by_username(self, username): if username.startswith("id:"): @@ -232,6 +231,11 @@ class MastodonAPI(): if code < 400: return response + if code == 401: + raise exception.StopExtraction( + "Invalid or missing access token.\n" + "Run 'gallery-dl oauth:mastodon:%s' to obtain one.", + self.extractor.instance) if code == 404: raise exception.NotFoundError() if code == 429: |
