Skip to content
Myr

urllib3 update

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 5937282 · Browse files · 1 file+30 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+30 added−9 removed

  • other:+30 added−9 removed

1 file+30 added−9 removed

modified:requests/packages/urllib3/connectionpool.py+30 added-9 removed
208 unmodified lines
209210 if timeout is _Default:211 timeout = self.timeout212213 conn.timeout = timeout # This only does anything in Py26+214215 conn.request(method, url, **httplib_request_kw)216 conn.sock.settimeout(timeout)217 httplib_response = conn.getresponse()218
26 unmodified lines
245246 More commonly, it's appropriate to use a convenience method provided247 by :class:`.RequestMethods`, such as :meth:`.request`.248249 .. note::250251 `release_conn` will only behave as expected if252 `preload_content=False` because we want to make253 `preload_content=False` the default behaviour someday soon without254 breaking backwards compatibility.255256 :param method:257 HTTP request method (such as GET, POST, PUT, etc.)258259 :param body:
27 unmodified lines
287 connection is available within the time period.288289 :param release_conn:290 If False, then the urlopen call will not release the connection282 back into the pool once a response is received. This is useful if283 you're not preloading the response's content immediately. You will284 need to call ``r.release_conn()`` on the response ``r`` to return285 the connection back into the pool. If None, it takes the value of291 back into the pool once a response is received (but will release if292 you read the entire contents of the response such as when293 `preload_content=True`). This is useful if you're not preloading294 the response's content immediately. You will need to call295 ``r.release_conn()`` on the response ``r`` to return the connection296 back into the pool. If None, it takes the value of297 ``response_kw.get('preload_content', True)``.298299 :param \**response_kw:300 Additional parameters are passed to
4 unmodified lines
305306 if retries < 0:307 raise MaxRetryError("Max retries exceeded for url: %s" % url)308309 if timeout is _Default:310 timeout = self.timeout311312 if release_conn is None:313 release_conn = response_kw.get('preload_content', True)314315 # Check host
33 unmodified lines
349 # The connection will be put back into the pool when350 # ``response.release_conn()`` is called (implicitly by351 # ``response.read()``)352339 except (SocketTimeout, Empty), e:340 # Timed out either by socket or queue341 raise TimeoutError("Request timed out after %s seconds" %342 self.timeout)353 except (Empty), e:354 # Timed out by queue355 raise TimeoutError("Request timed out. (pool_timeout=%s)" %356 pool_timeout)357358 except (SocketTimeout), e:359 # Timed out by socket360 raise TimeoutError("Request timed out. (timeout=%s)" %361 timeout)362363 except (BaseSSLError), e:364 # SSL certificate error365 raise SSLError(e)366
139 unmodified lines
506 # This code is actually similar to urlparse.urlsplit, but much507 # simplified for our needs.508 port = None509 scheme = 'http'491 if '//' in url:510 if '://' in url:511 scheme, url = url.split('://', 1)512 if '/' in url:513 url, _path = url.split('/', 1)514 if '@' in url:515 _auth, url = url.split('@', 1)516 if ':' in url:517 url, port = url.split(':', 1)518 port = int(port)519 return scheme, url, port
27 unmodified lines