requests/requests-oauthlib — pull request #35 by zvin (2013-04-24 08:22:28+00:00)
Title: No unicode in headers

Hi, you have a small problem in core.py: you want to remove unicode headers and you say in the comments:

> \# Having the authorization header, key or value, in unicode will
> \# result in UnicodeDecodeErrors when the request is concatenated
> \# by httplib. This can easily be seen when attaching files.
> \# Note that simply encoding the value is not enough since Python
> \# saves the type of first key set. Thus we remove and re-add.
> \# \>\>\> d = {u'a':u'foo'}
> \# \>\>\> d['a'] = 'foo'
> \# \>\>\> d
> \# { u'a' : 'foo' }

So you do this:
```python
u_header = unicode('Authorization')
if u_header in r.headers:
auth_header = r.headers[u_header].encode('utf-8')
del r.headers[u_header]
r.headers['Authorization'] = auth_header
```

But, in the beginning of the file you do:
```python
from __future__ import unicode_literals
```
so 'Authorization' is equivalent to u'Authorization' and there is still unicode in headers and, as you say in your comment, this results in UnicodeDecodeErrors when the request is concatenated by httplib.

You should do something like:
```python
r.headers['Authorization'.encode('utf-8')] = auth_header
```