use common base class for OAuth1.0 based API interfaces
This commit is contained in:
@@ -243,7 +243,7 @@ class FlickrSearchExtractor(FlickrExtractor):
|
||||
return self.api.photos_search(self.search)
|
||||
|
||||
|
||||
class FlickrAPI():
|
||||
class FlickrAPI(oauth.OAuth1API):
|
||||
"""Minimal interface for the flickr API"""
|
||||
API_URL = "https://api.flickr.com/services/rest/"
|
||||
API_KEY = "ac4fd7aa98585b9eee1ba761c209de68"
|
||||
@@ -264,20 +264,7 @@ class FlickrAPI():
|
||||
]
|
||||
|
||||
def __init__(self, extractor):
|
||||
api_key = extractor.config("api-key", self.API_KEY)
|
||||
api_secret = extractor.config("api-secret", self.API_SECRET)
|
||||
token = extractor.config("access-token")
|
||||
token_secret = extractor.config("access-token-secret")
|
||||
|
||||
if api_key and api_secret and token and token_secret:
|
||||
self.session = oauth.OAuth1Session(
|
||||
api_key, api_secret,
|
||||
token, token_secret,
|
||||
)
|
||||
self.api_key = None
|
||||
else:
|
||||
self.session = extractor.session
|
||||
self.api_key = api_key
|
||||
oauth.OAuth1API.__init__(self, extractor)
|
||||
|
||||
self.maxsize = extractor.config("size-max")
|
||||
if isinstance(self.maxsize, str):
|
||||
|
||||
Reference in New Issue
Block a user