Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add access_token support #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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