-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
URL encoding error #124
Comments
This error comes from urldecoding the response body, because Twitter is erroring out. Are you actually using 'a' and 'b' as your client key and secret? If you are, that will cause Twitter to refuse to validate you. If you aren't, you should confirm you've set them correctly. |
In my test I was not contacting Twitter, but another (less well known) service. I did not use 'a' and 'b' in my attempt, but the consumer key and signature that were provided to me by the OAuth provider. Anyway, it is good to know what probably caused the error. Is there a (recommended) way to catch and handle errors that may occur when calling oauth.fetch_request_token()? |
Not as far as I know: it might be nice to wrap this more cleanly for debugging and error handling purposes. @ib-lundgren, thoughts? |
First off, my apologies for this horribly vague error message. The error message is an old sore issue but will finally be updated the coming week since I now have time to work on OSS again. Regarding how to handle it I think the best way forward is to update fetch_request_token to deal with either a denied request or an incorrectly formatted responses better. Probably by raising something like
with a much better error message for both. Stay tuned for a fix the coming week. |
Decided to stick to ValueError for now but at least the error message should be much clearer and I've added a check for status codes over 400 to help out a bit there too. Added a bit more logging to so in the future, when you run into things, adding
might shed some light as well. |
Hrm, while most of these errors will likely be during development there might be some benefit to differentiating the 40x responses from the decoding error. Will add a TokenRequestDenied error with a status_code attribute for you to use. |
I tried OAuth 1 based on the OAuth workflow example at http:https://requests-oauthlib.readthedocs.org/en/latest/oauth1_workflow.html, but I get an error:
[snip]
File "C:\Python34\lib\site-packages\oauthlib-0.6.1-py3.4.egg\oauthlib\common.p
y", line 135, in urldecode
ValueError: Not a valid urlencoded string.
By the way, the same issue was raised on stackoverflow:
http:https://stackoverflow.com/questions/22965459/oauth1-with-requests-oauthlib-produces-url-encoding-error
The text was updated successfully, but these errors were encountered: