POSTing file while passing data as well using OAuth

Alright,

So, in 0.14.1, I've ran into the problem with using OAuth and posting a file and data (specifically with Twitter, updating a status with media (passing the media file and parameter `status`) or updating background image (passing image file and parameter `tile`).

``` python
auth = OAuth1(self.app_key, self.app_secret,
                               self.oauth_token, self.oauth_token_secret,
                               signature_type='auth_header')

client = requests.session(auth=self.auth)

url = 'https://api.twitter.com/1/account/update_profile_background_image.json'
file_ = '/Users/mikehelmick/Dropbox/Avatars/avvy1004112.jpg'
client.post(url, data={'tile': 'True'}, files={'image': (file_, open(file_, 'rb'))})
```

If auth signature_type is `auth_header` I get this error (I realize this is throws a TwythonError but this method worked in versions of `requests` as late as `0.14.0`:

```
Traceback (most recent call last):
  File "twython.py", line 571, in <module>
    print t.updateProfileBackgroundImage(file)
  File "twython.py", line 425, in updateProfileBackgroundImage
    **{'tile': tile})
  File "twython.py", line 464, in _media_update
    return self.post(url, params=params, files=file_)
  File "twython.py", line 249, in post
    return self.request(endpoint, 'POST', params=params, files=files, version=version)
  File "twython.py", line 241, in request
    content = self._request(url, method=method, params=params, files=files, api_call=url)
  File "twython.py", line 218, in _request
    retry_after=response.headers.get('retry-after'))
__main__.TwythonError: u'Unauthorized: Authentication credentials were missing or incorrect. -- Could not authenticate with OAuth.'
```

(^^ That is thrown when a status code is greater than 304)

Anyways, I'm looking into this, but it'd be appreciated if anyone else would like to take a look into this as well. :smile_cat: 


Sorry for taking so long to get around to this, I've been getting settled in to a new job. Totally my bad.

Two questions: first, is this still a problem for you? Second: if it does, does it look anything like #910?


M'kay, I'm closing this for inactivity. Please feel free to reopen it if this is still a problem for you.

Thanks for the report! =)


As of 0.14.2 it was. Was there a new version released? I didn't hear of one released?

Sent from my iPhone

On Nov 24, 2012, at 6:29 AM, Cory Benfield notifications@github.com wrote:

> M'kay, I'm closing this for inactivity. Please feel free to reopen it if this is still a problem for you.
> 
> Thanks for the report! =)
> 
> —
> Reply to this email directly or view it on GitHub.


## Nope, no new release.

Sent from my Android phone with K-9 Mail. Please excuse my brevity.


Awesome, can you answer the two questions I asked in my previous comment?


Sorry, I must have read the email and forgot to respond to those questions.
1.) Yes.
2.) No. My issue is posting a file and posting params with OAuth. Posting JUST params or posting JUST a file is fine. But when I try to combine the two (since 0.14.0 .. worked in that version) it has been broken. I think it's not signing something correctly now.


Sorry, I had an indepth trace of what was going on and I restarted my computer and iTerm closed :P haha


@michaelhelmick any updates?


@slingamn I've been super busy, but I guess the fixes are currently in requests but we're waiting on requests_oauthlib 0.3.0 to be released? I think..


@michaelhelmick since the fixes are currently in Requests and you're just waiting on requests_oauthlib, I'm going to close this, especially since it doesn't seem to affect 1.1.0. If you guys experience still experience it, let us know. Thanks.


Also, @michaelhelmick, I just checked and 0.3.0 was [released](https://crate.io/packages/requests-oauthlib/).