Skip to content

Commit 67deac5

Browse files
Wynndowfxdgear
authored andcommitted
Pass Retry object to urllib3 instead of False (elastic#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.
1 parent bc4af21 commit 67deac5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

elasticsearch/connection/http_urllib3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import ssl
33
import urllib3
44
from urllib3.exceptions import ReadTimeoutError, SSLError as UrllibSSLError
5+
from urllib3.util.retry import Retry
56
import warnings
67
import gzip
78

@@ -168,7 +169,7 @@ def perform_request(self, method, url, params=None, body=None, timeout=None, ign
168169
# again
169170
body = gzip.zlib.compress(body)
170171

171-
response = self.pool.urlopen(method, url, body, retries=False, headers=request_headers, **kw)
172+
response = self.pool.urlopen(method, url, body, retries=Retry(False), headers=request_headers, **kw)
172173
duration = time.time() - start
173174
raw_data = response.data.decode('utf-8')
174175
except Exception as e:

0 commit comments

Comments
 (0)