maraujop / requests-oauth

Python's Requests OAuth (Open Authentication) plugin
BSD 3-Clause "New" or "Revised" License
188 stars 33 forks source link

Trouble POSTing UTF-8 data #31

Closed samtardif closed 12 years ago

samtardif commented 12 years ago

I'm having some trouble POSTing UTF-8 content to Bitbucket's REST API. I see there are no tests covering UTF-8 content, so would like to get this verified.

If I make a POST request with the vanilla Requests library using a hardcoded auth=('un','pw) in my session I can submit content containing UTF-8 characters. If I make the same POST request via an authenticated session using requests-oauth Bitbucket gives me a 500 response. POST requests via requests-oauth that do not include UTF-8 content work just fine.

General approach is:

client = requests.session(hooks={ 'pre_request': OAuthHook(access_token = tok, access_token_secret = sec) }) client.post(url, data=request.form)

I've verified the exact same content being sent works via curl and via a vanilla Requests library client.post(), so something seems funny with requests-oauth's handling of unicode content. Any thoughts?

maraujop commented 12 years ago

I've pushed a fix for UTF-8 issues, this should be fixed now. Sorry for the inconvenience.

You can try version 0.4.1, it should be working now.

Cheers, Miguel