Make sure url is a string, not unicode in python 2

Fixes #133, thanks sheIIdon!
This commit is contained in:
Honza Král
2014-10-01 17:31:38 +02:00
parent 20aa35d791
commit 5fec49e261
+2
View File
@@ -40,6 +40,8 @@ class Urllib3HttpConnection(Connection):
kw = {}
if timeout:
kw['timeout'] = timeout
if not isinstance(url, str):
url = url.encode('utf-8')
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
duration = time.time() - start
raw_data = response.data.decode('utf-8')