Skip to content

Commit

Permalink
Add access_token support
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Widjaja committed Jul 10, 2017
1 parent 605f33c commit bbd776d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions disqusapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bbd776d

Please sign in to comment.