[smugmug] add OAuth support

This commit is contained in:
Mike Fährmann
2018-05-10 18:58:05 +02:00
parent 6a31ada9e3
commit f3483a2b7c
4 changed files with 25 additions and 3 deletions

View File

@@ -9,7 +9,7 @@
"""Utility classes to setup OAuth and link a users account to gallery-dl"""
from .common import Extractor, Message
from . import deviantart, flickr, reddit, tumblr
from . import deviantart, flickr, reddit, smugmug, tumblr
from .. import text, oauth, config
import os
import urllib.parse
@@ -212,6 +212,27 @@ class OAuthReddit(OAuthBase):
)
class OAuthSmugmug(OAuthBase):
subcategory = "smugmug"
pattern = ["oauth:smugmug$"]
def __init__(self, match):
OAuthBase.__init__(self, match)
self.session = oauth.OAuth1Session(
self.oauth_config("api-key", smugmug.SmugmugAPI.API_KEY),
self.oauth_config("api-secret", smugmug.SmugmugAPI.API_SECRET),
)
def items(self):
yield Message.Version, 1
self._oauth1_authorization_flow(
"https://api.smugmug.com/services/oauth/1.0a/getRequestToken",
"https://api.smugmug.com/services/oauth/1.0a/authorize",
"https://api.smugmug.com/services/oauth/1.0a/getAccessToken",
)
class OAuthTumblr(OAuthBase):
subcategory = "tumblr"
pattern = ["oauth:tumblr$"]