Comments (6)
Hey @nhooey, sorry for the slow reply.
Your gist works nicely for me using latest requests-oauthlib from pypi. Would you mind trying in a new virtual env and see if the error persists?
ps. I think you might be in a good position to give some pointers on how to improve that part of the docs too so if you have a few moments any input is much appreciated :)
from requests-oauthlib.
@ib-lundgren it seems like your suggestion does not work, at least in my case. Are there any news regarding this 'bug' or am I doing something wrong?
/tmp virtualenv2 ENV
New python executable in ENV/bin/python2
Also creating executable in ENV/bin/python
Installing setuptools, pip...done.
/tmp . ENV/bin/activate.fish
(ENV)/tmp pip install requests requests-oauthlib
Downloading/unpacking requests
Downloading requests-2.2.1-py2.py3-none-any.whl (625kB): 625kB downloaded
Downloading/unpacking requests-oauthlib
Downloading requests-oauthlib-0.4.0.tar.gz
Running setup.py (path:/tmp/ENV/build/requests-oauthlib/setup.py) egg_info for package requests-oauthlib
Downloading/unpacking oauthlib>=0.4.2 (from requests-oauthlib)
Downloading oauthlib-0.6.1.tar.gz (96kB): 96kB downloaded
Running setup.py (path:/tmp/ENV/build/oauthlib/setup.py) egg_info for package oauthlib
Installing collected packages: requests, requests-oauthlib, oauthlib
Running setup.py install for requests-oauthlib
Running setup.py install for oauthlib
Successfully installed requests requests-oauthlib oauthlib
Cleaning up...
(ENV)/tmp python
Python 2.7.6 (default, Feb 15 2014, 23:06:13)
[GCC 4.8.2 20140206 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from requests_oauthlib import OAuth1Session
>>> request_token_url = 'https://api.twitter.com/oauth/request_token'
>>> client_key = 'ident'
>>> client_secret = 'secret'
>>> oauth = OAuth1Session(client_key, client_secret=client_secret)
>>> fetch_response = oauth.fetch_request_token(request_token_url)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/ENV/lib/python2.7/site-packages/requests_oauthlib/oauth1_session.py", line 195, in fetch_request_token
token = self._fetch_token(url)
File "/tmp/ENV/lib/python2.7/site-packages/requests_oauthlib/oauth1_session.py", line 264, in _fetch_token
token = dict(urldecode(self.post(url).text))
File "/tmp/ENV/lib/python2.7/site-packages/oauthlib/common.py", line 135, in urldecode
raise ValueError('Not a valid urlencoded string.')
ValueError: Not a valid urlencoded string.
>>>
from requests-oauthlib.
okay, the problem is that twitter answers with the string
"Failed to validate oauth signature and token"
and thus https://github.com/idan/oauthlib/blob/master/oauthlib/common.py#L135 raises the error.
Do you guys think it would be an idea to suggest a change to L135, so that the user gets some more information? A suggestion could look like this
raise ValueError('\"{}\" is not a valid urlencoded string.'.format(query))
or du you think it is a bad idea? In some situations it could result in very verbose output.
from requests-oauthlib.
That verbosity does seem like it'd be a problem.
from requests-oauthlib.
Fix is in the pipeline and should be sorted over the next week. Both a more detailed error message as well as better handling of denied/incorrectly formatted token responses
from requests-oauthlib.
This error message has got a nice revamp in oauthlib 0.6.2 now and some extra logic has been added to requests-oauthlib to add even more detail to these errors. See #124 for more detail :)
from requests-oauthlib.
Related Issues (20)
- 'requests' distribution not found when listed in install_requires together with requests_oauthlib
- why passing requests kwargs that may contain request params to refresh_token request ? HOT 1
- Optional
- Felse HOT 2
- (Optinal)
- Superseded by #2445.
- Thanks for stopping by to let us know something could be better! HOT 1
- `oauth2_session.OAuth2Session.refresh_token` creates infinite loop with Exchange Online when token expires
- Trying to use OAuth1Session with Flickr - requests_oauthlib.oauth1_session.VerifierMissing: No client verifier has been set. HOT 1
- ## Description HOT 1
- Add refresh token exception hook to list of compliance hooks?
- Requirements out of date HOT 2
- Hkş HOT 2
- Scope changes with Microsoft services & `offline_access`
- Question: Is this project maintained? HOT 1
- Compliance fix for tokens that never expire (e.g. Mailchimp)
- Redo request after token is updated
- Why is the backend client workflow asking for a code or a response url? HOT 1
- refresh token workflow HOT 1
- rsengun HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from requests-oauthlib.