From 5fec49e2618ccab706ea360b18d57420478cd265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Wed, 1 Oct 2014 17:31:38 +0200 Subject: [PATCH] Make sure url is a string, not unicode in python 2 Fixes #133, thanks sheIIdon! --- elasticsearch/connection/http_urllib3.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/elasticsearch/connection/http_urllib3.py b/elasticsearch/connection/http_urllib3.py index 22f2795b..4d3592cc 100644 --- a/elasticsearch/connection/http_urllib3.py +++ b/elasticsearch/connection/http_urllib3.py @@ -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')