python-oauth2 icon indicating copy to clipboard operation
python-oauth2 copied to clipboard

POST data not included in Client.request http request

Open spectranaut opened this issue 12 years ago • 2 comments

The response from the following code https request claimed no POST data was included in the request. I believe this is unexpected and unwanted behavior?

import oauth2 as oauth

consumer_key = "<consumer key from twitter developer site>"
consumer_secret = "<consumer secret>"
oauth_token = "<access token>"
oauth_token_secret = "<access token secret>"
consumer = oauth.Consumer(key=consumer_key, secret=consumer_secret)
access_token = oauth.Token(key=oauth_token, secret=oauth_token_secret)
client = oauth.Client(consumer, access_token)

post_data = 'track=twitter'
stream_endpoint = "https://stream.twitter.com/1.1/statuses/filter.json"
response, data = client.request(stream_endpoint, "POST", body=post_data)

I tried to follow the problem to the source, and I believe it is because Request.to_postdata() does not return the body data. I can also provide the code that proves this.

I've noticed other recently complain on stackoverflow with the same problem! :( So I think something fishy is going on. I've not submitted a bug report before so let me know if if this could be better written.

spectranaut avatar Sep 18 '13 02:09 spectranaut

I have the same problems as you.

ovixiao avatar Feb 22 '14 07:02 ovixiao

I think this may have been fixed in the latest master branch. Can you see if this is fixed now?

jaitaiwan avatar Jul 29 '15 12:07 jaitaiwan