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.
This commit is contained in:
@@ -2,6 +2,7 @@ import time
|
|||||||
import ssl
|
import ssl
|
||||||
import urllib3
|
import urllib3
|
||||||
from urllib3.exceptions import ReadTimeoutError, SSLError as UrllibSSLError
|
from urllib3.exceptions import ReadTimeoutError, SSLError as UrllibSSLError
|
||||||
|
from urllib3.util.retry import Retry
|
||||||
import warnings
|
import warnings
|
||||||
import gzip
|
import gzip
|
||||||
|
|
||||||
@@ -168,7 +169,7 @@ class Urllib3HttpConnection(Connection):
|
|||||||
# again
|
# again
|
||||||
body = gzip.zlib.compress(body)
|
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
|
duration = time.time() - start
|
||||||
raw_data = response.data.decode('utf-8')
|
raw_data = response.data.decode('utf-8')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user