Repository URL to install this package:
|
Version:
2.0.0-beta3-4-armbian20.11.0-trunk1 ▾
|
wiperf
/
usr
/
local
/
lib
/
python3.7
/
dist-packages
/
requests
/
__pycache__
/
adapters.cpython-37.pyc
|
|---|
B
´>´º[«ã @ sÌ d Z ddlZddlZddlmZmZ ddlmZ ddl m
Z
ddl mZ ddl
mZ ddlmZ dd lmZ dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z!m"Z" ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0m1Z1m2Z2mZmZm3Z3m4Z4m5Z5m6Z6 ddl7m8Z8 yddl9m:Z: W n e;k
r dd Z:Y nX dZ<dZ=dZ>dZ?G d d! d!e@ZAG d"d# d#eAZBdS )$z
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
é N)ÚPoolManagerÚproxy_from_url)ÚHTTPResponse)Ú parse_url)ÚTimeout)ÚRetry)ÚClosedPoolError)ÚConnectTimeoutError)Ú HTTPError)Ú
MaxRetryError)ÚNewConnectionError)Ú
ProxyError)Ú
ProtocolError)ÚReadTimeoutError)ÚSSLError)Ú
ResponseError)ÚLocationValueErroré )ÚResponse)ÚurlparseÚ
basestring)ÚDEFAULT_CA_BUNDLE_PATHÚextract_zipped_pathsÚget_encoding_from_headersÚprepend_scheme_if_neededÚget_auth_from_urlÚ
urldefragauthÚselect_proxy)ÚCaseInsensitiveDict)Úextract_cookies_to_jar) ÚConnectionErrorÚConnectTimeoutÚReadTimeoutr r
Ú
RetryErrorÚ
InvalidSchemaÚInvalidProxyURLÚ
InvalidURL)Ú_basic_auth_str)ÚSOCKSProxyManagerc O s t dd S )Nz'Missing dependencies for SOCKS support.)r$ )ÚargsÚkwargs© r+ ú7/tmp/pip-install-fdhvs41_/requests/requests/adapters.pyr( . s r( Fé
c s2 e Zd ZdZ fddZdddZd d
Z ZS )ÚBaseAdapterzThe Base Transport Adapterc s t t| ¡ d S )N)Úsuperr. Ú__init__)Úself)Ú __class__r+ r, r0 : s zBaseAdapter.__init__FNTc C s t dS )aC Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
:param timeout: (optional) How long to wait for the server to send
data before giving up, as a float, or a :ref:`(connect timeout,
read timeout) <timeouts>` tuple.
:type timeout: float or tuple
:param 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
:param cert: (optional) Any user-provided SSL certificate to be trusted.
:param proxies: (optional) The proxies dictionary to apply to the request.
N)ÚNotImplementedError)r1 ÚrequestÚstreamÚtimeoutÚverifyÚcertÚproxiesr+ r+ r, Úsend= s zBaseAdapter.sendc C s t dS )z!Cleans up adapter specific items.N)r3 )r1 r+ r+ r, ÚcloseO s zBaseAdapter.close)FNTNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r0 r: r; Ú
__classcell__r+ r+ )r2 r, r. 7 s
r. c s e Zd ZdZdddddgZeeeef fdd Zd d
Z dd Z
efd
dZdd Zdd Z
dd Zd$ddZdd Zdd Zdd Zdd Zd%d"d#Z ZS )&ÚHTTPAdaptera The built-in HTTP Adapter for urllib3.
Provides a general-case interface for Requests sessions to contact HTTP and
HTTPS urls by implementing the Transport Adapter interface. This class will
usually be created by the :class:`Session <Session>` class under the
covers.
:param pool_connections: The number of urllib3 connection pools to cache.
:param pool_maxsize: The maximum number of connections to save in the pool.
:param max_retries: The maximum number of retries each connection
should attempt. Note, this applies only to failed DNS lookups, socket
connections and connection timeouts, never to requests where data has
made it to the server. By default, Requests does not retry failed
connections. If you need granular control over the conditions under
which we retry a request, import urllib3's ``Retry`` class and pass
that instead.
:param pool_block: Whether the connection pool should block for connections.
Usage::
>>> import requests
>>> s = requests.Session()
>>> a = requests.adapters.HTTPAdapter(max_retries=3)
>>> s.mount('http://', a)
Úmax_retriesÚconfigÚ_pool_connectionsÚ
_pool_maxsizeÚ_pool_blockc sd |t krtddd| _nt |¡| _i | _i | _tt| ¡ || _ || _
|| _| j|||d d S )Nr F)Úread)Úblock)
ÚDEFAULT_RETRIESr rB Úfrom_intrC Ú
proxy_managerr/ rA r0 rD rE rF Úinit_poolmanager)r1 Úpool_connectionsÚpool_maxsizerB Ú
pool_block)r2 r+ r, r0 q s zHTTPAdapter.__init__c s fdd j D S )Nc s i | ]}t |d |qS )N)Úgetattr)Ú.0Úattr)r1 r+ r, ú
<dictcomp> s z,HTTPAdapter.__getstate__.<locals>.<dictcomp>)Ú __attrs__)r1 r+ )r1 r, Ú__getstate__ s zHTTPAdapter.__getstate__c C sH i | _ i | _x | ¡ D ]\}}t| || qW | j| j| j| jd d S )N)rH )rK rC ÚitemsÚsetattrrL rD rE rF )r1 ÚstaterR Úvaluer+ r+ r, Ú__setstate__ s zHTTPAdapter.__setstate__c K s0 || _ || _|| _tf |||dd|| _dS )a Initializes a urllib3 PoolManager.
This method should not be called from user code, and is only
exposed for use when subclassing the
:class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.
:param connections: The number of urllib3 connection pools to cache.
:param maxsize: The maximum number of connections to save in the pool.
:param block: Block when no free connections are available.
:param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager.
T)Ú num_poolsÚmaxsizerH ÚstrictN)rD rE rF r Úpoolmanager)r1 Úconnectionsr\ rH Úpool_kwargsr+ r+ r, rL s
zHTTPAdapter.init_poolmanagerc K s || j kr| j | }n|| ¡ d¡r^t|\}}t|f||| j| j| jd| }| j |<