update 'oauth:mastodon:<instance>' code
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright 2017-2020 Mike Fährmann
|
# Copyright 2017-2021 Mike Fährmann
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"""Utility classes to setup OAuth and link accounts to gallery-dl"""
|
"""Utility classes to setup OAuth and link accounts to gallery-dl"""
|
||||||
|
|
||||||
from .common import Extractor, Message
|
from .common import Extractor, Message
|
||||||
from . import deviantart, flickr, reddit, smugmug, tumblr
|
from . import deviantart, flickr, mastodon, reddit, smugmug, tumblr
|
||||||
from .. import text, oauth, util, config, exception
|
from .. import text, oauth, util, config, exception
|
||||||
from ..cache import cache
|
from ..cache import cache
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
@@ -324,8 +324,10 @@ class OAuthMastodon(OAuthBase):
|
|||||||
def items(self):
|
def items(self):
|
||||||
yield Message.Version, 1
|
yield Message.Version, 1
|
||||||
|
|
||||||
application = self.oauth_config(self.instance)
|
for application in mastodon.INSTANCES.values():
|
||||||
if not application:
|
if self.instance == application["root"].partition("://")[2]:
|
||||||
|
break
|
||||||
|
else:
|
||||||
application = self._register(self.instance)
|
application = self._register(self.instance)
|
||||||
|
|
||||||
self._oauth2_authorization_code_grant(
|
self._oauth2_authorization_code_grant(
|
||||||
|
|||||||
@@ -219,10 +219,6 @@ class TestExtractorWait(unittest.TestCase):
|
|||||||
|
|
||||||
class TextExtractorOAuth(unittest.TestCase):
|
class TextExtractorOAuth(unittest.TestCase):
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setUpClass(cls):
|
|
||||||
mastodon.generate_extractors()
|
|
||||||
|
|
||||||
def test_oauth1(self):
|
def test_oauth1(self):
|
||||||
for category in ("flickr", "smugmug", "tumblr"):
|
for category in ("flickr", "smugmug", "tumblr"):
|
||||||
extr = extractor.find("oauth:" + category)
|
extr = extractor.find("oauth:" + category)
|
||||||
|
|||||||
Reference in New Issue
Block a user