ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/
Upload File :
Current File : //proc/self/root/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyc

�
Bu�_c@sgdZddlZddlZddlmZmZddlmZddl	m
Z
ddl	mZddl
mZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddl 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/m0Z0m1Z1m2Z2mZmZm3Z3m4Z4m5Z5m6Z6ddl7m8Z8yddl9m:Z:Wne;k
rd�Z:nXe<Z=dZ>dZ?dZAdeBfd ��YZCd!eCfd"��YZDdS(#s�
requests.adapters
~~~~~~~~~~~~~~~~~

This module contains the transport adapters that Requests uses to define
and maintain connections.
i����N(tPoolManagertproxy_from_url(tHTTPResponse(t	parse_url(tTimeout(tRetry(tClosedPoolError(tConnectTimeoutError(t	HTTPError(t
MaxRetryError(tNewConnectionError(t
ProxyError(t
ProtocolError(tReadTimeoutError(tSSLError(t
ResponseError(tLocationValueErrori(tResponse(turlparset
basestring(tDEFAULT_CA_BUNDLE_PATHtextract_zipped_pathstget_encoding_from_headerstprepend_scheme_if_neededtget_auth_from_urlt
urldefragauthtselect_proxy(tCaseInsensitiveDict(textract_cookies_to_jar(	tConnectionErrortConnectTimeouttReadTimeoutRRt
RetryErrort
InvalidSchematInvalidProxyURLt
InvalidURL(t_basic_auth_str(tSOCKSProxyManagercOstd��dS(Ns'Missing dependencies for SOCKS support.(R!(targstkwargs((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyR%.si
itBaseAdaptercBs8eZdZd�Zededdd�Zd�ZRS(sThe Base Transport AdaptercCstt|�j�dS(N(tsuperR(t__init__(tself((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyR*:scCs
t�dS(sCSends 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(tNotImplementedError(R+trequesttstreamttimeouttverifytcerttproxies((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pytsend=scCs
t�dS(s!Cleans up adapter specific items.N(R,(R+((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pytcloseOsN(	t__name__t
__module__t__doc__R*tFalsetNonetTrueR3R4(((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyR(7s
		tHTTPAdaptercBs�eZdZdddddgZeeeed�Zd�Zd�Z	ed	�Z
d
�Zd�Zd�Z
dd
�Zd�Zd�Zd�Zd�Zededdd�ZRS(s�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)
    tmax_retriestconfigt_pool_connectionst
_pool_maxsizet_pool_blockcCs�|tkr$tddt�|_ntj|�|_i|_i|_tt|�j	�||_
||_||_|j
||d|�dS(Nitreadtblock(tDEFAULT_RETRIESRR8R<tfrom_intR=t
proxy_managerR)R;R*R>R?R@tinit_poolmanager(R+tpool_connectionstpool_maxsizeR<t
pool_block((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyR*qs					cs�fd��jD�S(Ncs%i|]}t�|d�|�qS(N(tgetattrR9(t.0tattr(R+(sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pys
<dictcomp>�s	(t	__attrs__(R+((R+sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyt__getstate__�scCsbi|_i|_x*|j�D]\}}t|||�qW|j|j|jd|j�dS(NRB(RER=titemstsetattrRFR>R?R@(R+tstateRLtvalue((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyt__setstate__�s		c
KsF||_||_||_td|d|d|dt|�|_dS(sInitializes 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_poolstmaxsizeRBtstrictN(R>R?R@RR:tpoolmanager(R+tconnectionsRURBtpool_kwargs((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyRF�s

			c
Ks�||jkr|j|}n�|j�jd�r�t|�\}}t|d|d|d|jd|jd|j|�}|j|<nJ|j|�}t	|d|d|jd|jd|j|�}|j|<|S(s�Return urllib3 ProxyManager for the given proxy.

        This method should not be called from user code, and is only
        exposed for use when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        :param proxy: The proxy to return a urllib3 ProxyManager for.
        :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager.
        :returns: ProxyManager
        :rtype: urllib3.ProxyManager
        tsockstusernametpasswordRTRURBt
proxy_headers(
REtlowert
startswithRR%R>R?R@R]R(R+tproxytproxy_kwargstmanagerR[R\R]((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pytproxy_manager_for�s*				cCs�|j�jd�r�|r�d	}|tk	r6|}n|sKtt�}n|setjj|�r}t	dj
|���nd|_tjj|�s�||_
q�||_nd|_d	|_
d	|_|r�t|t�s�|d|_|d|_n||_d	|_|jrItjj|j�rIt	dj
|j���n|jr�tjj|j�r�t	dj
|j���q�nd	S(
sAVerify a SSL certificate. This method should not be called from user
        code, and is only exposed for use when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        :param conn: The urllib3 connection object associated with the cert.
        :param url: The requested URL.
        :param verify: 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: The SSL certificate to verify.
        thttpssECould not find a suitable TLS CA certificate bundle, invalid path: {}t
CERT_REQUIREDt	CERT_NONEiis9Could not find the TLS certificate file, invalid path: {}s1Could not find the TLS key file, invalid path: {}N(R^R_R9R:RRtostpathtexiststIOErrortformatt	cert_reqstisdirtca_certstca_cert_dirt
isinstanceRt	cert_filetkey_file(R+tconnturlR0R1tcert_loc((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pytcert_verify�s8						
				cCs�t�}t|dd�|_tt|di��|_t|j�|_||_|jj	|_	t
|jt�r�|jj
d�|_n|j|_t|j||�||_||_|S(s�Builds a :class:`Response <requests.Response>` object from a urllib3
        response. This should not be called from user code, and is only exposed
        for use when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`

        :param req: The :class:`PreparedRequest <PreparedRequest>` used to generate the response.
        :param resp: The urllib3 response object.
        :rtype: requests.Response
        tstatustheaderssutf-8N(RRJR9tstatus_codeRRxRtencodingtrawtreasonRpRttbytestdecodeRtcookiesR-t
connection(R+treqtresptresponse((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pytbuild_response�s
				cCs�t||�}|rit|d�}t|�}|jsHtd��n|j|�}|j|�}n*t|�}|j�}|j	j|�}|S(s�Returns a urllib3 connection for the given URL. This should not be
        called from user code, and is only exposed for use when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        :param url: The URL to connect to.
        :param proxies: (optional) A Requests-style dictionary of proxies used on this request.
        :rtype: urllib3.ConnectionPool
        thttpsFPlease check proxy URL. It is malformed and could be missing the host.(
RRRthostR"Rctconnection_from_urlRtgeturlRW(R+RtR2R`t	proxy_urlRERstparsed((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pytget_connection$s		cCs5|jj�x!|jj�D]}|j�qWdS(s�Disposes of any internal state.

        Currently, this closes the PoolManager and any active ProxyManager,
        which closes any pooled connections.
        N(RWtclearREtvalues(R+R`((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyR4?s
c	Cs�t|j|�}t|j�j}|o3|dk}t}|rit|�jj�}|jd�}n|j}|r�|r�t|j�}n|S(s?Obtain the url to use when making the final request.

        If the message is being sent through a HTTP proxy, the full URL has to
        be used. Otherwise, we should only use the path portion of the URL.

        This should not be called from user code, and is only exposed for use
        when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        :param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
        :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs.
        :rtype: str
        RdRZ(	RRtRtschemeR8R^R_tpath_urlR(	R+R-R2R`R�tis_proxied_http_requesttusing_socks_proxytproxy_schemeRt((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pytrequest_urlIs	
cKsdS(s"Add any headers needed by the connection. As of v2.0 this does
        nothing by default, but is left for overriding by users that subclass
        the :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        This should not be called from user code, and is only exposed for use
        when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        :param request: The :class:`PreparedRequest <PreparedRequest>` to add headers to.
        :param kwargs: The keyword arguments from the call to send().
        N((R+R-R'((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pytadd_headersfscCs8i}t|�\}}|r4t||�|d<n|S(sReturns a dictionary of the headers to add to any request sent
        through a proxy. This works with urllib3 magic to ensure that they are
        correctly sent to the proxy, rather than in a tunnelled request if
        CONNECT is being used.

        This should not be called from user code, and is only exposed for use
        when subclassing the
        :class:`HTTPAdapter <requests.adapters.HTTPAdapter>`.

        :param proxy: The url of the proxy being used for this request.
        :rtype: dict
        sProxy-Authorization(RR$(R+R`RxR[R\((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyR]ts
cCs�y|j|j|�}Wn%tk
r@}t|d|��nX|j||j||�|j||�}	|j|d|d|d|d|d|�|jdkp�d|j	k}
t
|t�ry%|\}}td|d	|�}WqEt
k
r}d
j|�}
t
|
��qEXn't
|t�r0ntd|d	|�}y�|
s�|jd|jd|	d
|jd|j	dtdtdtdtd|jd|�
}nft|d�r�|j}n|jdt�}y"|j|j|	dt�x-|j	j�D]\}}|j||�q�W|j�x^|jD]S}|jtt|��djd��|jd�|j|�|jd�q2W|jd�y|j dt�}Wnt!k
r�|j �}nXt"j#|d|d|dtdt�}Wn|j$��nXWn�t%t&j'fk
r<}
t(|
d|��n{t)k
r}t
|j*t+�r�t
|j*t,�s�t-|d|��q�nt
|j*t.�r�t/|d|��nt
|j*t0�r�t1|d|��nt
|j*t2�r�t3|d|��nt(|d|��n�t4k
r5}t(|d|��n�t0k
rS}t1|��ndt2t5fk
r�}t
|t2�r�t3|d|��q�t
|t6�r�t7|d|��q��nX|j8||�S(sSends 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 or urllib3 Timeout object
        :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.
        :rtype: requests.Response
        R-R.R/R0R1R2sContent-LengthtconnectRAsrInvalid timeout {}. Pass a (connect, read) timeout tuple, or a single float to set both timeouts to the same valuetmethodRttbodyRxtredirecttassert_same_hosttpreload_contenttdecode_contenttretriest
proxy_pooltskip_accept_encodingisutf-8s
s0

t	bufferingtpoolR�N(9R�RtRR#RvR�R�R�R9RxRpttupletTimeoutSaucet
ValueErrorRkturlopenR�R8R<thasattrR�t	_get_conntDEFAULT_POOL_TIMEOUTt
putrequestR:ROt	putheadert
endheadersR3thextlentencodetgetresponset	TypeErrorRtfrom_httplibR4RtsocketterrorRR	R|RR
RRR t_ProxyErrorRt	_SSLErrorRRt
_HTTPErrorR
RR�(R+R-R.R/R0R1R2RsteRttchunkedR�RAterrR�tlow_conntheaderRRtitr((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyR3�s�+						
&





N(R5R6R7RMtDEFAULT_POOLSIZERCtDEFAULT_POOLBLOCKR*RNRSRFRcRvR�R9R�R4R�R�R]R8R:R3(((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyR;Ts$				%	4	%	
			(ER7tos.pathRgR�tpip._vendor.urllib3.poolmanagerRRtpip._vendor.urllib3.responseRtpip._vendor.urllib3.utilRRR�tpip._vendor.urllib3.util.retryRtpip._vendor.urllib3.exceptionsRRRR�R	R
RR�RR
RR�RRtmodelsRtcompatRRtutilsRRRRRRRt
structuresRRRt
exceptionsRRRR R!R"R#tauthR$t!pip._vendor.urllib3.contrib.socksR%tImportErrorR8R�R�RCR9R�tobjectR(R;(((sN/opt/alt/python36/lib/python3.6/site-packages/pip/_vendor/requests/adapters.pyt<module>	sF4@



Zerion Mini Shell 1.0