Requests#
Classes:
|
An HTTPAdapter subclass customized to use Junction for endpoint discovery and load-balancing. |
|
A drop-in replacement for a requests.Session that uses Junction for discovery and load-balancing. |
- class junction.requests.HTTPAdapter(junction_client: Junction, **kwargs)[source]#
An HTTPAdapter subclass customized to use Junction for endpoint discovery and load-balancing.
You should almost never need to use this class directly, use a Session instead.
Methods:
init_poolmanager
(connections, maxsize[, block])Initializes a urllib3 PoolManager.
send
(request[, stream, timeout, verify, ...])Sends PreparedRequest object.
- init_poolmanager(connections, maxsize, block=False, **pool_kwargs)[source]#
Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only exposed for use when subclassing the
HTTPAdapter
.- Parameters:
connections – The number of urllib3 connection pools to cache.
maxsize – The maximum number of connections to save in the pool.
block – Block when no free connections are available.
pool_kwargs – Extra keyword arguments used to initialize the Pool Manager.
- send(
- request: PreparedRequest,
- stream: bool = False,
- timeout: None | float | tuple[float, float] | tuple[float, None] = None,
- verify: bool | str = True,
- cert: None | bytes | str | tuple[bytes | str, bytes | str] = None,
- proxies: Mapping[str, str] | None = None,
Sends PreparedRequest object. Returns Response object.
- Parameters:
request – The
PreparedRequest
being sent.stream – (optional) Whether to stream the request content.
timeout (float or tuple or urllib3 Timeout object) – (optional) How long to wait for the server to send data before giving up.
verify – (optional) Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use
cert – (optional) Any user-provided SSL certificate to be trusted.
proxies – (optional) The proxies dictionary to apply to the request.
- Return type:
requests.Response