"""Prepares the given HTTP headers."""
if headers:
- if is_py2:
- headers = dict((builtin_str(name), value) for name, value in headers.items())
+ headers = dict((name.encode('ascii'), value) for name, value in headers.items())
self.headers = CaseInsensitiveDict(headers)
else:
self.headers = CaseInsensitiveDict()
import requests
from requests.auth import HTTPDigestAuth
-from requests.compat import is_py2, str
+from requests.compat import str
try:
import StringIO
requests.get(httpbin('ΓΈ'), params={'foo': 'foo'})
def test_unicode_header_name(self):
- if is_py2:
- requests.put(httpbin('put'), headers={unicode('Content-Type'): 'application/octet-stream'}, data='\xff')
+ requests.put(httpbin('put'), headers={str('Content-Type'): 'application/octet-stream'}, data='\xff') # compat.str is unicode.
def test_urlencoded_get_query_multivalued_param(self):