Skip to content
Myr

Use basestring instead of str to determine when to return headers as-is. This makes sure that unicode instances aren't enumerated.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Greg Taylor · committed by Greg Taylor · parent a74481a · Browse files · 2 files+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+4 added−1 removed

  • other:+4 added−1 removed

2 files+4 added−1 removed

modified:requests/compat.py+2 added
86 unmodified lines
87 from StringIO import StringIO8889 bytes = str90 str = unicode91 basestring = basestring92939495elif is_py3:
4 unmodified lines
100 from io import StringIO101102 str = str103 bytes = bytes104 basestring = (str,bytes)105
modified:requests/utils.py+2 added-1 removed
16 unmodified lines
17import zlib1819from .compat import parse_http_list as _parse_list_header20from .compat import quote, unquote, cookielib, SimpleCookie, is_py221from .compat import basestring222324def dict_from_string(s):25 """Returns a MultiDict with Cookies."""
120 unmodified lines
146147 if isinstance(headers, dict):148 headers = list(headers.items())149149 elif isinstance(headers, str):150 elif isinstance(headers, basestring):151 return headers152153 for i, (value, params) in enumerate(headers):154
254 unmodified lines