class documentation

Allows for arbitrary requests while transparently keeping track of necessary connection pools for you. :param num_pools: Number of connection pools to cache before discarding the least recently used pool. :param headers: Headers to include with all requests, unless other headers are given explicitly. :param \**connection_pool_kw: Additional parameters are used to create fresh :class:`urllib3.connectionpool.ConnectionPool` instances. Example:: >>> manager = PoolManager(num_pools=2) >>> r = manager.request('GET', 'http://google.com/') >>> r = manager.request('GET', 'http://google.com/mail') >>> r = manager.request('GET', 'http://yahoo.com/') >>> len(manager.pools) 2

Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Method clear Empty our store of pools and direct them all to close.
Method connection_from_context Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context.
Method connection_from_host Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme.
Method connection_from_pool_key Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key.
Method connection_from_url Similar to :func:`urllib3.connectionpool.connection_from_url`.
Method urlopen Same as :meth:`urllib3.HTTPConnectionPool.urlopen` with custom cross-host redirect logic and only sends the request-uri portion of the ``url``.
Class Variable proxy Undocumented
Class Variable proxy_config Undocumented
Instance Variable connection_pool_kw Undocumented
Instance Variable key_fn_by_scheme Undocumented
Instance Variable pool_classes_by_scheme Undocumented
Instance Variable pools Undocumented
Method _merge_pool_kwargs Merge a dictionary of override values for self.connection_pool_kw.
Method _new_pool Create a new :class:`urllib3.connectionpool.ConnectionPool` based on host, port, scheme, and any additional pool keyword arguments.
Method _proxy_requires_url_absolute_form Indicates if the proxy requires the complete destination URL in the request. Normally this is only needed when not using an HTTP CONNECT tunnel.
Method _validate_proxy_scheme_url_selection Validates that were not attempting to do TLS in TLS connections on Python2 or with unsupported SSL implementations.

Inherited from RequestMethods:

Method request Make a request using :meth:`urlopen` with the appropriate encoding of ``fields`` based on the ``method`` used.
Method request_encode_body Make a request using :meth:`urlopen` with the ``fields`` encoded in the body. This is useful for request methods like POST, PUT, PATCH, etc.
Method request_encode_url Make a request using :meth:`urlopen` with the ``fields`` encoded in the url. This is useful for request methods like GET, HEAD, DELETE, etc.
Instance Variable headers Undocumented
Class Variable _encode_url_methods Undocumented
def __enter__(self): (source)

Undocumented

def __exit__(self, exc_type, exc_val, exc_tb): (source)

Undocumented

def __init__(self, num_pools=10, headers=None, **connection_pool_kw): (source)
def clear(self): (source)

Empty our store of pools and direct them all to close. This will not affect in-flight connections, but they will not be re-used after completion.

def connection_from_context(self, request_context): (source)

Get a :class:`urllib3.connectionpool.ConnectionPool` based on the request context. ``request_context`` must at least contain the ``scheme`` key and its value must be a key in ``key_fn_by_scheme`` instance variable.

def connection_from_host(self, host, port=None, scheme='http', pool_kwargs=None): (source)

Get a :class:`urllib3.connectionpool.ConnectionPool` based on the host, port, and scheme. If ``port`` isn't given, it will be derived from the ``scheme`` using ``urllib3.connectionpool.port_by_scheme``. If ``pool_kwargs`` is provided, it is merged with the instance's ``connection_pool_kw`` variable and used to create the new connection pool, if one is needed.

def connection_from_pool_key(self, pool_key, request_context=None): (source)

Get a :class:`urllib3.connectionpool.ConnectionPool` based on the provided pool key. ``pool_key`` should be a namedtuple that only contains immutable objects. At a minimum it must have the ``scheme``, ``host``, and ``port`` fields.

def connection_from_url(self, url, pool_kwargs=None): (source)

Similar to :func:`urllib3.connectionpool.connection_from_url`. If ``pool_kwargs`` is not provided and a new pool needs to be constructed, ``self.connection_pool_kw`` is used to initialize the :class:`urllib3.connectionpool.ConnectionPool`. If ``pool_kwargs`` is provided, it is used instead. Note that if a new pool does not need to be created for the request, the provided ``pool_kwargs`` are not used.

def urlopen(self, method, url, redirect=True, **kw): (source)

Same as :meth:`urllib3.HTTPConnectionPool.urlopen` with custom cross-host redirect logic and only sends the request-uri portion of the ``url``. The given ``url`` parameter must be absolute, such that an appropriate :class:`urllib3.connectionpool.ConnectionPool` can be chosen for it.

Undocumented

proxy_config = (source)

Undocumented

connection_pool_kw = (source)

Undocumented

key_fn_by_scheme = (source)

Undocumented

pool_classes_by_scheme = (source)

Undocumented

Undocumented

def _merge_pool_kwargs(self, override): (source)

Merge a dictionary of override values for self.connection_pool_kw. This does not modify self.connection_pool_kw and returns a new dict. Any keys in the override dictionary with a value of ``None`` are removed from the merged dictionary.

def _new_pool(self, scheme, host, port, request_context=None): (source)

Create a new :class:`urllib3.connectionpool.ConnectionPool` based on host, port, scheme, and any additional pool keyword arguments. If ``request_context`` is provided, it is provided as keyword arguments to the pool class used. This method is used to actually create the connection pools handed out by :meth:`connection_from_url` and companion methods. It is intended to be overridden for customization.

def _proxy_requires_url_absolute_form(self, parsed_url): (source)

Indicates if the proxy requires the complete destination URL in the request. Normally this is only needed when not using an HTTP CONNECT tunnel.

def _validate_proxy_scheme_url_selection(self, url_scheme): (source)

Validates that were not attempting to do TLS in TLS connections on Python2 or with unsupported SSL implementations.