Add explanation of url encoding
This commit is contained in:
@@ -40,8 +40,12 @@ class Urllib3HttpConnection(Connection):
|
|||||||
kw = {}
|
kw = {}
|
||||||
if timeout:
|
if timeout:
|
||||||
kw['timeout'] = timeout
|
kw['timeout'] = timeout
|
||||||
|
|
||||||
|
# in python2 we need to make sure the url is not unicode. Otherwise
|
||||||
|
# the body will be decoded into unicode too and that will fail (#133).
|
||||||
if not isinstance(url, str):
|
if not isinstance(url, str):
|
||||||
url = url.encode('utf-8')
|
url = url.encode('utf-8')
|
||||||
|
|
||||||
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
|
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
|
||||||
duration = time.time() - start
|
duration = time.time() - start
|
||||||
raw_data = response.data.decode('utf-8')
|
raw_data = response.data.decode('utf-8')
|
||||||
|
|||||||
Reference in New Issue
Block a user