Requests 0.8 breaks requests-oauth
idan opened this issue · 1 comments
idan commented
It appears that 0.8 breaks something in requests-oauth.
consider the following code:
# I'm assuming you have CONSUMER_KEY, CONSUMER_SECRET,
# TWITTER_TOKEN, TWITTER_SECRET already.
import requests
from oauth_hook.hook import OAuthHook
OAuthHook.consumer_key = CONSUMER_KEY
OAuthHook.consumer_secret = CONSUMER_SECRET
hook = OAuthHook(TWITTER_TOKEN, TWITTER_SECRET)
client = requests.session(hooks={'pre_request': hook})
r1 = client.get('http://api.twitter.com/1/account/rate_limit_status.json')
print(r1)
r2 = client.get('http://api.twitter.com/1/account/verify_credentials.json')
print(r2)
With requests 0.7.6, both requests return 200. With 0.8.x, the 2nd (and subsequent request) return HTTP/500.
I checked with keep-alive disabled, but it doesn't solve the issue. :(
maraujop commented
I've found why this happens and reported it in requests:
https://github.com/kennethreitz/requests/issues/272
I will wait for @kennethreitz answer.