Issue #526

Added test and updated _encode_files.

Had me really confused there for a moment with the bytes = str, str = unicode.... I haven't gotten a py3 environment up yet. I really need to, I know. Passes all tests in py2.


Hows it look?


Hmm, is there a way to kick Travis for arbitrary branches?

@travisbot kick


did i do something wrong? should i pull request off a local branch named develop?


Oh, no, you didn't do anything wrong. I was just curious if I could get Travis to run tests on your branch by talking to it.

+1 for this change :-)


@barberj there is some (likely trivial) merge conflict now; can you update? Sorry.


@slingamn done


@barberj hey sorry, it looks like the merge is messed up; upstream changes since your branch are showing as part of your branch.

Can you try this?

```
git branch backup_branch 56f968f4e
git reset --hard 56f968f4e
git fetch --all
git rebase parent/develop
```


@slingamn its not letting me push...
! [rejected]        issue_526 -> issue_526 (non-fast-forward)


Ah, you need `push -f`. Do `git branch backup_merge_branch db11bee` to save a backup of the ref you'll be overwriting.


@slingamn looks like that did it. thanks


Hmm, I don't think it worked; if it had worked, this pull request would show as updated.

Just for kicks, I rebased your branch in my fork. Try this:

```
git fetch https://slingamn@github.com/slingamn/requests.git +issue_526_rebased
git reset --hard FETCH_HEAD
git push -f origin issue_526
```


It worked.  commit 8667efd it shows import cookielib, instead of SimpleCookie which was part of the conflict. I pushed up my backup_branch if you want to verify requests/models.py (84c4bd4142ae5711fef5c02db11da11bee0414ef) to see that import...


Oh, yeah, you're right. Unfortunately, the rebase is against an old version of `develop` and is still conflicting against the current version. (The conflict is trivial, in `AUTHORS.rst`.)

You could try this.

```
git checkout develop
git fetch git://github.com/kennethreitz/requests.git +develop
git reset --hard FETCH_HEAD
git checkout issue_526
git rebase develop
```

I have my `develop` branch set up to track the `develop` branch of `kennethreitz/requests`, rather than `slingamn/requests`, which avoids this problem at the cost of being counterintuitive / confusing.


This pull request [fails](http://travis-ci.org/kennethreitz/requests/builds/1261579) (merged e912a6f5 into 7b6338c4).


did it, but says everything is up to date 


Travis (http://travis-ci.org/#!/kennethreitz/requests/jobs/1261582) is complaining about this Python 3 issue:

```
[shivaram@good-fortune ~/workspace/requests/tests]$ python3 ./test_requests.py 
  File "./test_requests.py", line 347
    post4 = post(url, files={'fname.txt': u'fdata'})
```


er

```
[shivaram@good-fortune ~/workspace/requests/tests]$ python3 ./test_requests.py 
  File "./test_requests.py", line 347
    post4 = post(url, files={'fname.txt': u'fdata'})
                                                 ^
SyntaxError: invalid syntax
```


(But your merge is now up-to-date --- awesome. Sorry about all the headaches.)


This pull request [passes](http://travis-ci.org/kennethreitz/requests/builds/1261634) (merged 64eb415e into 7b6338c4).


+1 for merging this patch, looks great.

For extra cake, could you assert in one of the unit tests that httpbin actually does see the correct file data (as in your documentation change)?

But I like this patch either way, nice work :-)


This pull request [passes](http://travis-ci.org/kennethreitz/requests/builds/1261761) (merged b0669027 into 7b6338c4).


@slingamn good call. obvious test case that i missed... mmm cake.


@kennethreitz want to merge this? Looks correct, is tested, Travis likes it, it closes #526.


Beautiful, thanks!