Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.urllib3.connectionpool Namespace Reference

Data Structures

class  ConnectionPool
 
class  HTTPConnectionPool
 
class  HTTPSConnectionPool
 

Functions

 connection_from_url (url, **kw)
 
 _normalize_host (host, scheme)
 
 _close_pool_connections (pool)
 

Variables

 weakref_finalize = weakref.finalize
 
 xrange = six.moves.xrange
 
 log = logging.getLogger(__name__)
 
 _Default = object()
 
dict _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK}
 

Function Documentation

◆ _close_pool_connections()

_close_pool_connections (   pool)
protected
Drains a queue of connections and closes each one.

Definition at line 1124 of file connectionpool.py.

1124def _close_pool_connections(pool):
1125 """Drains a queue of connections and closes each one."""
1126 try:
1127 while True:
1128 conn = pool.get(block=False)
1129 if conn:
1130 conn.close()
1131 except queue.Empty:
1132 pass # Done.
for i

References i.

Referenced by HTTPConnectionPool.close().

Here is the caller graph for this function:

◆ _normalize_host()

_normalize_host (   host,
  scheme 
)
protected
Normalize hosts for comparisons and use with sockets.

Definition at line 1106 of file connectionpool.py.

1106def _normalize_host(host, scheme):
1107 """
1108 Normalize hosts for comparisons and use with sockets.
1109 """
1110
1111 host = normalize_host(host, scheme)
1112
1113 # httplib doesn't like it when we include brackets in IPv6 addresses
1114 # Specifically, if we include brackets but also pass the port then
1115 # httplib crazily doubles up the square brackets on the Host header.
1116 # Instead, we need to make sure we never pass ``None`` as the port.
1117 # However, for backward compatibility reasons we can't actually
1118 # *assert* that. See http://bugs.python.org/issue28539
1119 if host.startswith("[") and host.endswith("]"):
1120 host = host[1:-1]
1121 return host
1122
1123

References i.

◆ connection_from_url()

connection_from_url (   url,
**  kw 
)
Given a url, return an :class:`.ConnectionPool` instance of its host.

This is a shortcut for not having to parse out the scheme, host, and port
of the url before creating an :class:`.ConnectionPool` instance.

:param url:
    Absolute URL string that must include the scheme. Port is optional.

:param \\**kw:
    Passes additional parameters to the constructor of the appropriate
    :class:`.ConnectionPool`. Useful for specifying things like
    timeout, maxsize, headers, etc.

Example::

    >>> conn = connection_from_url('http://google.com/')
    >>> r = conn.request('GET', '/')

Definition at line 1078 of file connectionpool.py.

1078def connection_from_url(url, **kw):
1079 """
1080 Given a url, return an :class:`.ConnectionPool` instance of its host.
1081
1082 This is a shortcut for not having to parse out the scheme, host, and port
1083 of the url before creating an :class:`.ConnectionPool` instance.
1084
1085 :param url:
1086 Absolute URL string that must include the scheme. Port is optional.
1087
1088 :param \\**kw:
1089 Passes additional parameters to the constructor of the appropriate
1090 :class:`.ConnectionPool`. Useful for specifying things like
1091 timeout, maxsize, headers, etc.
1092
1093 Example::
1094
1095 >>> conn = connection_from_url('http://google.com/')
1096 >>> r = conn.request('GET', '/')
1097 """
1098 scheme, host, port = get_host(url)
1099 port = port or port_by_scheme.get(scheme, 80)
1100 if scheme == "https":
1101 return HTTPSConnectionPool(host, port=port, **kw)
1102 else:
1103 return HTTPConnectionPool(host, port=port, **kw)
1104
1105

References i.

Variable Documentation

◆ _blocking_errnos

dict _blocking_errnos = {errno.EAGAIN, errno.EWOULDBLOCK}
protected

Definition at line 109 of file connectionpool.py.

◆ _Default

_Default = object()
protected

Definition at line 64 of file connectionpool.py.

◆ log

log = logging.getLogger(__name__)

Definition at line 62 of file connectionpool.py.

◆ weakref_finalize

weakref_finalize = weakref.finalize

Definition at line 56 of file connectionpool.py.

◆ xrange

xrange = six.moves.xrange

Definition at line 60 of file connectionpool.py.