%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/
Upload File :
Create Path :
Current File : //opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyo

�
�wMVc@s�dZddlZddlmZddlmZmZddlmZddl	m
Zddlm
Z
mZmZmZdd	lmZmZmZmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZ ddl!m"Z"ddl#m$Z$m
Z
mZmZddl%m&Z&e'Z(dZ)dZ*de+fd��YZ,de,fd��YZ-dS(s�
requests.adapters
~~~~~~~~~~~~~~~~~

This module contains the transport adapters that Requests uses to define
and maintain connections.
i����Ni(tResponse(tPoolManagertproxy_from_url(tHTTPResponse(tTimeout(turlparset
basestringt	urldefragtunquote(tDEFAULT_CA_BUNDLE_PATHtget_encoding_from_headerstprepend_scheme_if_neededtget_auth_from_url(tCaseInsensitiveDict(t
MaxRetryError(tTimeoutError(tSSLError(t	HTTPError(t
ProxyError(textract_cookies_to_jar(tConnectionErrorRRR(t_basic_auth_stri
itBaseAdaptercBs)eZdZd�Zd�Zd�ZRS(sThe Base Transport AdaptercCstt|�j�dS(N(tsuperRt__init__(tself((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyR&scCs
t�dS(N(tNotImplementedError(R((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pytsend)scCs
t�dS(N(R(R((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pytclose,s(t__name__t
__module__t__doc__RRR(((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyR#s		tHTTPAdaptercBs�eZdZdddddgZeeeed�Zd�Zd�Z	ed	�Z
d
�Zd�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 int max_retries: The maximum number of retries each connection
        should attempt. Note, this applies only to failed connections and
        timeouts, never to requests where the server returns a response.
    :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_blockcCsc||_i|_i|_tt|�j�||_||_||_|j	||d|�dS(Ntblock(
R!R"t
proxy_managerRR RR#R$R%tinit_poolmanager(Rtpool_connectionstpool_maxsizeR!t
pool_block((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyRIs						cst�fd��jD��S(Nc3s'|]}|t�|d�fVqdS(N(tgetattrtNone(t.0tattr(R(sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pys	<genexpr>Ys(tdictt	__attrs__(R((RsN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyt__getstate__XscCsbi|_i|_x*|j�D]\}}t|||�qW|j|j|jd|j�dS(NR&(R'R"titemstsetattrR(R#R$R%(RtstateR/tvalue((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyt__setstate__\s		cCs=||_||_||_td|d|d|�|_dS(s�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.
        t	num_poolstmaxsizeR&N(R#R$R%Rtpoolmanager(RtconnectionsR9R&((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyR(hs

			cCs�|j�jd�ro|rod}|tk	r6|}n|sEt}n|sZtd��nd|_||_nd|_d|_|r�t|t	�s�|d|_
|d|_q�||_
ndS(s�Verify 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: Whether we should actually verify the certificate.
        :param cert: The SSL certificate to verify.
        thttpss4Could not find a suitable SSL CA certificate bundle.t
CERT_REQUIREDt	CERT_NONEiiN(tlowert
startswithR-tTrueR	t	Exceptiont	cert_reqstca_certst
isinstanceRt	cert_filetkey_file(Rtconnturltverifytcerttcert_loc((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pytcert_verifyys"
					
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.
        tstatustheaderssutf-8N(RR,R-tstatus_codeR
ROR
tencodingtrawtreasonRERItbytestdecodeRtcookiestrequestt
connection(Rtreqtresptresponse((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pytbuild_response�s					cCs�|p	i}|jt|j��j�}|r�t|d�}|j|�}||jkr�t|d|d|jd|j	d|j
�|j|<n|j|j|�}n*t|�}|j�}|j
j|�}|S(seReturns 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.
        thttpt
proxy_headersR8R9R&(tgetRR?tschemeRR^R'RR#R$R%tconnection_from_urltgeturlR:(RRItproxiestproxyR^RHtparsed((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pytget_connection�s"		cCs|jj�dS(s�Disposes of any internal state.

        Currently, this just closes the PoolManager, which closes pooled
        connections.
        N(R:tclear(R((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyR�scCsd|p	i}t|j�j}|j|�}|rW|dkrWt|j�\}}n	|j}|S(sObtain 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 to proxy URLs.
        R<(RRIR`R_Rtpath_url(RRWRcR`RdRIt_((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pytrequest_url�s
	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((RRWtkwargs((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pytadd_headersscCs>i}t|�\}}|r:|r:t||�|d<n|S(s3Returns 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 proxies: The url of the proxy being used for this request.
        :param kwargs: Optional additional keyword arguments.
        sProxy-Authorization(RR(RRdROtusernametpassword((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyR^s
cCs|j|j|�}|j||j||�|j||�}|j|�|jdkphd|jk}	td|d|�}y�|	s�|j	d|j
d|d|jd|jdtd	td
tdtd|jd
|�
}
nIt
|d�r�|j}n|jd
|�}y�|j|j
|dt�x-|jj�D]\}}
|j||
�q:W|j�x^|jD]S}|jtt|��djd��|jd�|j|�|jd�qnW|jd�|j�}tj|d|d|d
tdt�}
Wn|j��nX|j|�Wn�tjk
rU}t |d|��n�t!k
ry}t |d|��n�t"k
r�}t#|��ndt$t%fk
r�}t&|t$�r�t'|d|��q�t&|t(�r�t)|d|��q��nX|j*||
�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) The timeout on the request.
        :param verify: (optional) Whether to verify SSL certificates.
        :param cert: (optional) Any user-provided SSL certificate to be trusted.
        :param proxies: (optional) The proxies dictionary to apply to the request.
        sContent-LengthtconnecttreadtmethodRItbodyROtredirecttassert_same_hosttpreload_contenttdecode_contenttretriesttimeoutt
proxy_pooltskip_accept_encodingisutf-8s
s0

tpoolRXRWN(+RfRIRMRjRlRrR-ROtTimeoutSauceturlopenRqtFalseR!thasattrRyt	_get_connt
putrequestRAR3t	putheadert
endheadersRthextlentencodetgetresponseRtfrom_httplibRt	_put_conntsocketterrorRRt_ProxyErrorRt	_SSLErrort
_HTTPErrorRERRRR\(RRWtstreamRxRJRKRcRHRItchunkedRZtlow_conntheaderR6titrtsockerrte((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyR&sv
					
&




N(RRRR1tDEFAULT_POOLSIZEtDEFAULT_RETRIEStDEFAULT_POOLBLOCKRR2R7R(RMR\R-RfRRjRlR^R~RAR(((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyR 0s"	
			%	$ 				(.RR�tmodelsRtpackages.urllib3.poolmanagerRRtpackages.urllib3.responseRtpackages.urllib3.utilRR|tcompatRRRRtutilsR	R
RRt
structuresR
tpackages.urllib3.exceptionsRRRR�RR�RR�RVRt
exceptionsRtauthRR~R�R�R�tobjectRR (((sN/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/adapters.pyt<module>	s*"""

Zerion Mini Shell 1.0