From 67deac55c41b2a243861e4787e0fe88c7cabe132 Mon Sep 17 00:00:00 2001 From: Chris Wynne Date: Tue, 24 Jul 2018 19:24:13 +0100 Subject: [PATCH] Pass `Retry` object to urllib3 instead of False (#827) By passing a `Retry` object to `urlopen` instead of just `False`, it prevents `urllib3` from having to create a Retry object with `from_int`. `from_int` emits an undesirable log message when called with `retries=False`, and this can be avoided by the method described above. --- elasticsearch/connection/http_urllib3.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/elasticsearch/connection/http_urllib3.py b/elasticsearch/connection/http_urllib3.py index c58944e9..9d78c918 100644 --- a/elasticsearch/connection/http_urllib3.py +++ b/elasticsearch/connection/http_urllib3.py @@ -2,6 +2,7 @@ import time import ssl import urllib3 from urllib3.exceptions import ReadTimeoutError, SSLError as UrllibSSLError +from urllib3.util.retry import Retry import warnings import gzip @@ -168,7 +169,7 @@ class Urllib3HttpConnection(Connection): # again body = gzip.zlib.compress(body) - response = self.pool.urlopen(method, url, body, retries=False, headers=request_headers, **kw) + response = self.pool.urlopen(method, url, body, retries=Retry(False), headers=request_headers, **kw) duration = time.time() - start raw_data = response.data.decode('utf-8') except Exception as e: