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

On v3, please provide only secret_key OR public_key. #9

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
4 changes: 2 additions & 2 deletions disqusapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ class DisqusAPI(Resource):
def __init__(self, secret_key=None, public_key=None, format='json', version='3.0', **kwargs):
self.secret_key = secret_key
self.public_key = public_key
if not public_key:
warnings.warn('You should pass ``public_key`` in addition to your secret key.')
if secret_key and public_key:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this doesn't warn them if they omit both. Not sure if it is necessary, just pointing out.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.

I cannot find out an entrypoint that does not require at least the public_key, but here is said that Disqus "recommend using SSL for all requests to the API, but it is not required for anonymous requests.".

Question is: what "anonymous requests" means? If nothing can be hit without public or secret key, is safe to raise an exception for this case.

If someone can confirm that, I will happily update the PR to raise an exception for no key provided, or at least put one more warning.

warnings.warn('Disqus ignores the ``secret_key`` if ``public_key`` is provided. Please provide only the secret key.')
self.format = format
self.version = version
super(DisqusAPI, self).__init__(self)
Expand Down