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

Broken with update of python-requests #42

Open
mart-e opened this issue Dec 19, 2012 · 3 comments
Open

Broken with update of python-requests #42

mart-e opened this issue Dec 19, 2012 · 3 comments

Comments

@mart-e
Copy link
Contributor

mart-e commented Dec 19, 2012

An update of requests seems to have broken the package. The most notably is the creation of sessions where it used to work with request.session(hooks=...). The current version of requests does not accept any arguments for the constructor. I don't know exactly when it happened as I haven't used the package for some time.

However I guess there is more problems because moving the hooks parameter outside the constructor does not fix the problem. It seems that the parameters used in the hooks are not sent with the request. The test suite fails for 9 of the 13 Twitter tests (haven't tested for other networks).

Version of python-requests used : 1.0.3-1

@codydjango
Copy link

Yeah they removed the pre_request event. Not sure how it can work otherwise. Update requirements requests==0.14.2.

@mart-e
Copy link
Contributor Author

mart-e commented Dec 22, 2012

The author off requests created request-oauthlib that uses oauthlib. I haven't look how they did it there but maybe there is inspiration t take.

@hoeken
Copy link

hoeken commented May 29, 2013

hey guys, i figured how to use the current version of requests... here's some sample code. Hope this helps someone!

OAuthHook.consumer_key = consumer_key
OAuthHook.consumer_secret = consumer_secret
oauth_hook = OAuthHook(access_token, access_token_secret, header_auth=True)

request = requests.Request('POST', url, data=parameters, files=files)
request = oauth_hook(request)
session = requests.session()
response = session.send(request.prepare(), timeout=timeout)
result = response.json()

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