From b92d591026c62e34a80f73fc6c09d2753f4d1930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Thu, 26 Feb 2015 14:14:33 -0800 Subject: [PATCH] Make method utf-8 for urllib3 fixes #201 --- elasticsearch/connection/http_urllib3.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/elasticsearch/connection/http_urllib3.py b/elasticsearch/connection/http_urllib3.py index 57bf8ea9..c729ae1a 100644 --- a/elasticsearch/connection/http_urllib3.py +++ b/elasticsearch/connection/http_urllib3.py @@ -63,10 +63,13 @@ class Urllib3HttpConnection(Connection): if 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). + # in python2 we need to make sure the url and method are not + # unicode. Otherwise the body will be decoded into unicode too and + # that will fail (#133, #201). if not isinstance(url, str): url = url.encode('utf-8') + if not isinstance(method, str): + method = method.encode('utf-8') response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw) duration = time.time() - start