From bbd776d08ee3ed1742bc7c591aa1f80778073c17 Mon Sep 17 00:00:00 2001 From: Andrew Widjaja Date: Mon, 10 Jul 2017 12:25:47 +1000 Subject: [PATCH] Add access_token support --- disqusapi/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/disqusapi/__init__.py b/disqusapi/__init__.py index 6c5b62b..ceb3f2a 100644 --- a/disqusapi/__init__.py +++ b/disqusapi/__init__.py @@ -163,6 +163,8 @@ def _request(self, endpoint=None, **kwargs): kwargs['api_secret'] = api.secret_key if 'api_public' not in kwargs and api.public_key: kwargs['api_key'] = api.public_key + if 'access_token' not in kwargs and api.access_token: + kwargs['access_token'] = api.access_token # We need to ensure this is a list so that # multiple values for a key work @@ -232,10 +234,11 @@ class DisqusAPI(Resource): 'json': (json.loads, ValueError), } - def __init__(self, secret_key=None, public_key=None, format='json', version='3.0', - timeout=None, interfaces=INTERFACES, **kwargs): + def __init__(self, secret_key=None, public_key=None, access_token=None, format='json', + version='3.0', timeout=None, interfaces=INTERFACES, **kwargs): self.secret_key = secret_key self.public_key = public_key + self.access_token = access_token if not public_key: warnings.warn('You should pass ``public_key`` in addition to your secret key.') self.format = format