summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/urllib3/connection.py6
-rw-r--r--src/urllib3/contrib/pyopenssl.py4
-rw-r--r--src/urllib3/contrib/securetransport.py4
-rw-r--r--src/urllib3/util/retry.py3
-rw-r--r--src/urllib3/util/timeout.py17
-rw-r--r--src/urllib3/util/url.py4
6 files changed, 19 insertions, 19 deletions
diff --git a/src/urllib3/connection.py b/src/urllib3/connection.py
index f0396f25..27bc1867 100644
--- a/src/urllib3/connection.py
+++ b/src/urllib3/connection.py
@@ -412,9 +412,9 @@ class VerifiedHTTPSConnection(HTTPSConnection):
if not cert.get("subjectAltName", ()):
warnings.warn(
(
- "Certificate for {0} has no `subjectAltName`, falling back to check for a " # noqa
- "`commonName` for now. This feature is being removed by major browsers and " # noqa
- "deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 " # noqa
+ "Certificate for {0} has no `subjectAltName`, falling back to check for a "
+ "`commonName` for now. This feature is being removed by major browsers and "
+ "deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 "
"for details.)".format(hostname)
),
SubjectAltNameWarning,
diff --git a/src/urllib3/contrib/pyopenssl.py b/src/urllib3/contrib/pyopenssl.py
index 58ea971e..3051ef3a 100644
--- a/src/urllib3/contrib/pyopenssl.py
+++ b/src/urllib3/contrib/pyopenssl.py
@@ -187,7 +187,7 @@ def _dnsname_to_stdlib(name):
try:
for prefix in [u"*.", u"."]:
if name.startswith(prefix):
- name = name[len(prefix) :] # noqa
+ name = name[len(prefix) :]
return prefix.encode("ascii") + idna.encode(name)
return idna.encode(name)
except idna.core.IDNAError:
@@ -349,7 +349,7 @@ class WrappedSocket(object):
total_sent = 0
while total_sent < len(data):
sent = self._send_until_done(
- data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE] # noqa
+ data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE]
)
total_sent += sent
diff --git a/src/urllib3/contrib/securetransport.py b/src/urllib3/contrib/securetransport.py
index 7b975c0d..24e6b5c4 100644
--- a/src/urllib3/contrib/securetransport.py
+++ b/src/urllib3/contrib/securetransport.py
@@ -616,9 +616,7 @@ class WrappedSocket(object):
def sendall(self, data):
total_sent = 0
while total_sent < len(data):
- sent = self.send(
- data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE] # noqa
- )
+ sent = self.send(data[total_sent : total_sent + SSL_WRITE_BLOCKSIZE])
total_sent += sent
def shutdown(self):
diff --git a/src/urllib3/util/retry.py b/src/urllib3/util/retry.py
index c26f48c9..5a049fe6 100644
--- a/src/urllib3/util/retry.py
+++ b/src/urllib3/util/retry.py
@@ -210,6 +210,7 @@ class Retry(object):
raise_on_status=self.raise_on_status,
history=self.history,
remove_headers_on_redirect=self.remove_headers_on_redirect,
+ respect_retry_after_header=self.respect_retry_after_header,
)
params.update(kw)
return type(self)(**params)
@@ -294,7 +295,7 @@ class Retry(object):
this method will return immediately.
"""
- if response:
+ if self.respect_retry_after_header and response:
slept = self.sleep_for_retry(response)
if slept:
return
diff --git a/src/urllib3/util/timeout.py b/src/urllib3/util/timeout.py
index 6623bbad..c1dc1e97 100644
--- a/src/urllib3/util/timeout.py
+++ b/src/urllib3/util/timeout.py
@@ -46,19 +46,20 @@ class Timeout(object):
:type total: integer, float, or None
:param connect:
- The maximum amount of time to wait for a connection attempt to a server
- to succeed. Omitting the parameter will default the connect timeout to
- the system default, probably `the global default timeout in socket.py
+ The maximum amount of time (in seconds) to wait for a connection
+ attempt to a server to succeed. Omitting the parameter will default the
+ connect timeout to the system default, probably `the global default
+ timeout in socket.py
<http://hg.python.org/cpython/file/603b4d593758/Lib/socket.py#l535>`_.
None will set an infinite timeout for connection attempts.
:type connect: integer, float, or None
:param read:
- The maximum amount of time to wait between consecutive
- read operations for a response from the server. Omitting
- the parameter will default the read timeout to the system
- default, probably `the global default timeout in socket.py
+ The maximum amount of time (in seconds) to wait between consecutive
+ read operations for a response from the server. Omitting the parameter
+ will default the read timeout to the system default, probably `the
+ global default timeout in socket.py
<http://hg.python.org/cpython/file/603b4d593758/Lib/socket.py#l535>`_.
None will set an infinite timeout.
@@ -195,7 +196,7 @@ class Timeout(object):
def get_connect_duration(self):
""" Gets the time elapsed since the call to :meth:`start_connect`.
- :return: Elapsed time.
+ :return: Elapsed time in seconds.
:rtype: float
:raises urllib3.exceptions.TimeoutStateError: if you attempt
to get duration for a timer that hasn't been started.
diff --git a/src/urllib3/util/url.py b/src/urllib3/util/url.py
index 2ba45360..f225cd8b 100644
--- a/src/urllib3/util/url.py
+++ b/src/urllib3/util/url.py
@@ -149,7 +149,7 @@ def split_first(s, delims):
if min_idx is None or min_idx < 0:
return s, "", None
- return s[:min_idx], s[min_idx + 1 :], min_delim # noqa
+ return s[:min_idx], s[min_idx + 1 :], min_delim
def _encode_invalid_chars(component, allowed_chars, encoding="utf-8"):
@@ -173,7 +173,7 @@ def _encode_invalid_chars(component, allowed_chars, encoding="utf-8"):
for i in range(0, len(uri_bytes)):
# Will return a single character bytestring on both Python 2 & 3
- byte = uri_bytes[i : i + 1] # noqa
+ byte = uri_bytes[i : i + 1]
byte_ord = ord(byte)
if (is_percent_encoded and byte == b"%") or (
byte_ord < 128 and byte.decode() in allowed_chars