Skip to content

Instantly share code, notes, and snippets.

@nbargnesi
Created January 31, 2013 14:35
Show Gist options
  • Save nbargnesi/4683244 to your computer and use it in GitHub Desktop.
Save nbargnesi/4683244 to your computer and use it in GitHub Desktop.
261,262c261,262
< # Except the ``url``. Requests on Py3 *really* wants that to be a
< # string, not bytes.
---
> # Except the ``url`` and ``headers``. Requests on Py3 *really*
> # wants those to be strings, not bytes.
264c264
< bytes_headers = {}
---
> _headers = {}
269c269
< if headers is not None:
---
> if headers is not None and not IS_PY3:
271c271,273
< bytes_headers[force_bytes(k)] = force_bytes(v)
---
> _headers[force_bytes(k)] = force_bytes(v)
> else:
> _headers = headers
273c275
< resp = requests_method(url, data=bytes_body, headers=bytes_headers, files=files,
---
> resp = requests_method(url, data=bytes_body, headers=_headers, files=files,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment