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

Name Errors obtaining resource owner key/secret #158

Closed
jhbrewer264 opened this issue Oct 28, 2014 · 3 comments
Closed

Name Errors obtaining resource owner key/secret #158

jhbrewer264 opened this issue Oct 28, 2014 · 3 comments

Comments

@jhbrewer264
Copy link

I keep encountering an error stating 'OauthSession1' and 'Oauth1' are undefined when attempting to authenticate with twitter. I have been using a basic function call:

from requests_oauthlib import OAuth1Session

consumer_key = raw_input("Please enter your consumer key: ")
consumer_secret = raw_input("Please enter your consumer secret: ")

requesttokenurl = 'https://api.twitter.com/oauth/request_token'

oauth = Oauth1Session(consumer_key, consumer_secret=consumer_secret)
fetch_response = oauth.fetch_request_token(requesttokenurl)

any suggestions as to why this may be producing the error in line 8:
oauth = Oauth1Session(consumer_key, consumer_secret=consumer_secret)
NameError: name 'Oauth1Session' is not defined

Thanks for the help

@ib-lundgren
Copy link
Member

Names in python are case sensitive. Try OAuth1Session and OAuth1 instead of Oauth1Session and Oauth (uppercase a)

@jhbrewer264
Copy link
Author

Hi ib,

Thank you very much for the response. I noticed the capitalization issue later, sorry for the silly question! There still seems to be an issue with the script though -- the issue is with the same line (line 8 - oauth =....) but appears to be an issue with the argument. I got this error off of running the same script with the proper capitalization:

line 52, in init
signature_type, rsa_key, verifier, decoding=decoding, **kwargs)
TypeError: init() got an unexpected keyword argument 'consumer_secret'

Any ideas why this may be happening? Thank you again for all of the help.

@ib-lundgren
Copy link
Member

Apologies for the late reply! It is client_secret, not consumer_secret

Please check the method definitionin the docs for more details http:https://requests-oauthlib.readthedocs.org/en/latest/api.html#oauth-1-0-session or for the ultimate source of truth, check the source code https://github.com/requests/requests-oauthlib/blob/master/requests_oauthlib/oauth1_session.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants