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

Key Error response['access_token'] before message handled #24

Closed
paulnurkkala opened this issue Jan 7, 2016 · 5 comments
Closed

Key Error response['access_token'] before message handled #24

paulnurkkala opened this issue Jan 7, 2016 · 5 comments

Comments

@paulnurkkala
Copy link

Oauth2: using the getToken method, basically following this tutorial: https://www.wepay.com/developer/overview/build-a-crowdfunding-site

Okay weird title, but hopefully this will help break it down...

I was (stupidly) using an incorrect client ID/secret, and when wepay/api.py, in the get_token function was returning, I was getting a key error on line 126, where it checks to set the self.access_token.

What I'm finding, is that, if there's an error returned by the previous line (self.call), it will not do anything with that error because the code will error out on the response['access_token'] because 'access_token' won't be set when the code errors out.

Here are a couple screenshots because I'm not great at explaining: http://imgur.com/a/oKcnJ/all

Swapping that line to: self.access_token = response.get('access_token', None)
clears the keyerror, but doesn't do much in terms of helping you know wthat there's a problem. BUT the error is at least there in the response.

So.. yeah. Just some thoughts. I can make a PR for that if you want, or you can just try it out and test it ourself.

@gravitation1
Copy link

It looks like you may not be using the latest version of the SDK. I believe the commit 4e4ec5c may have resolved this issue. Can you try pulling the latest and see if you continue to hit the issue?

@paulnurkkala
Copy link
Author

Is that the version in PyPi?

On Thu, Jan 7, 2016 at 12:14 PM, gravitation1 notifications@github.com
wrote:

It looks like you may not be using the latest version of the SDK. I
believe the commit 4e4ec5c
4e4ec5c
may have resolved this issue. Can you try pulling the latest and see if you
continue to hit the issue?


Reply to this email directly or view it on GitHub
#24 (comment).

@paulnurkkala
Copy link
Author

Okay this is working better with the manual pull. But it's not what I got from PyPi, so maybe update the packages there?

Thanks for the response!

@aroundthesea
Copy link
Contributor

Hey @paulnurkkala! We just updated the version on PyPI (wepay 0.3.2). Thanks!

@paulnurkkala
Copy link
Author

Awesome thank you!

On Thu, Jan 7, 2016 at 1:34 PM Amy notifications@github.com wrote:

Hey @paulnurkkala https://github.com/paulnurkkala! We just updated the
version on PyPI (wepay 0.3.2 https://pypi.python.org/pypi/wepay/0.3.2).
Thanks!


Reply to this email directly or view it on GitHub
#24 (comment).

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