Skip to content

Commit

Permalink
Pass Retry object to urllib3 instead of False (#827)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Wynndow authored and fxdgear committed Jul 24, 2018
1 parent bc4af21 commit 67deac5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion elasticsearch/connection/http_urllib3.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import ssl
import urllib3
from urllib3.exceptions import ReadTimeoutError, SSLError as UrllibSSLError
from urllib3.util.retry import Retry
import warnings
import gzip

Expand Down Expand Up @@ -168,7 +169,7 @@ def perform_request(self, method, url, params=None, body=None, timeout=None, ign
# 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:
Expand Down

0 comments on commit 67deac5

Please sign in to comment.