MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 18.226.226.208
Web Server : Apache
System : Linux md-in-83.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : a1673wkz ( 2475)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyo
�
>�P_c@@sGddlmZddlZyddlmZWn!ek
rSddlmZnXddlmZddl	m
Z
mZddl	mZddl
mZmZmZdd	lmZdd
lmZddlmZdd
dgZeje�ZdZie
d6ed6Zdefd��YZd
efd��YZd�ZdS(i(tabsolute_importN(turljoini(tRecentlyUsedContainer(tHTTPConnectionPooltHTTPSConnectionPool(tport_by_scheme(tLocationValueErrort
MaxRetryErrortProxySchemeUnknown(tRequestMethods(t	parse_url(tRetrytPoolManagertProxyManagertproxy_from_urltkey_filet	cert_filet	cert_reqstca_certstssl_versiontca_cert_dirthttpthttpscB@skeZdZdZddd�Zd�Zd�Zd�Zd�Z	ddd�Z
d	�Zed
�Z
RS(s$
    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

    i
cK@s>tj||�||_t|dd��|_t|_dS(Ntdispose_funccS@s
|j�S(N(tclose(tp((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyt<lambda>Bs(R	t__init__tconnection_pool_kwRtpoolstpool_classes_by_scheme(tselft	num_poolstheadersR((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyR>s
		cC@s|S(N((R((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyt	__enter__GscC@s|j�tS(N(tcleartFalse(Rtexc_typetexc_valtexc_tb((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyt__exit__Js
cC@se|j|}|j}|dkrU|jj�}x!tD]}|j|d�q8Wn||||�S(s
        Create a new :class:`ConnectionPool` based on host, port and scheme.

        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.
        RN(RRtcopytSSL_KEYWORDStpoptNone(Rtschemethosttporttpool_clstkwargstkw((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyt	_new_poolOs
	
cC@s|jj�dS(s�
        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.
        N(RR#(R((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyR#`sRc
C@s�|std��n|pd}|p6tj|d�}|||f}|jj�C|jj|�}|rq|S|j|||�}||j|<WdQX|S(s�
        Get a :class:`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``.
        sNo host specified.RiPN(RRtgetRtlockR3(RR.R/R-tpool_keytpool((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pytconnection_from_hostis
cC@s.t|�}|j|jd|jd|j�S(s*
        Similar to :func:`urllib3.connectionpool.connection_from_url` but
        doesn't pass any additional parameters to the
        :class:`urllib3.connectionpool.ConnectionPool` constructor.

        Additional parameters are taken from the :class:`.PoolManager`
        constructor.
        R/R-(R
R8R.R/R-(Rturltu((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pytconnection_from_url�s	c
K@s�t|�}|j|jd|jd|j�}t|d<t|d<d|krf|jj�|d<n|jd
k	r�|jdkr�|j
|||�}n|j
||j|�}|o�|j�}|s�|St
||�}|jdkr�d}n|jd	�}	t|	t�s-tj|	d|�}	n|	jrq|j|�rqx(|	jD]}
|dj|
d
�qPWny"|	j||d
|d|�}	Wn!tk
r�|	jr��n|SX|	|d	<||d<tjd||�|j
|||�S(s]
        Same as :meth:`urllib3.connectionpool.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.
        R/R-tassert_same_hosttredirectR!Ri/tGETtretriestresponset_poolsRedirecting %s -> %sN(R
R8R.R/R-R$R!R)tproxyR,turlopentrequest_uritget_redirect_locationRtstatusR4t
isinstanceRtfrom_inttremove_headers_on_redirecttis_same_hostR+t	incrementRtraise_on_redirecttlogtinfo(RtmethodR9R=R2R:tconnR@tredirect_locationR?theader((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyRC�s@	$

		"
	

N(t__name__t
__module__t__doc__R,RBRR"R(R3R#R8R;tTrueRC(((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyR s							cB@sGeZdZdddd�Zddd�Zdd�Zed�ZRS(sw
    Behaves just like :class:`PoolManager`, but sends all requests through
    the defined proxy, using the CONNECT method for HTTPS URLs.

    :param proxy_url:
        The URL of the proxy to be used.

    :param proxy_headers:
        A dictionary contaning headers that will be sent to the proxy. In case
        of HTTP they are being sent with each request, while in the
        HTTPS/CONNECT case they are sent only once. Could be used for proxy
        authentication.

    Example:
        >>> proxy = urllib3.ProxyManager('http://localhost:3128/')
        >>> r1 = proxy.request('GET', 'http://google.com/')
        >>> r2 = proxy.request('GET', 'http://httpbin.org/')
        >>> len(proxy.pools)
        1
        >>> r3 = proxy.request('GET', 'https://httpbin.org/')
        >>> r4 = proxy.request('GET', 'https://twitter.com/')
        >>> len(proxy.pools)
        3

    i
cK@s�t|t�r.d|j|j|jf}nt|�}|jsmtj|jd�}|jd|�}n|jdkr�t	|j��n||_
|p�i|_|j
|d<|j|d<tt
|�j|||�dS(	Ns
%s://%s:%iiPR/RRt_proxyt_proxy_headers(shttpR(RGRR-R.R/R
RR4t_replaceRRBt
proxy_headerstsuperR
R(Rt	proxy_urlR R!RZRRBR/((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyR�s		

RcC@sV|dkr(tt|�j|||�Stt|�j|jj|jj|jj�S(NR(R[R
R8RBR.R/R-(RR.R/R-((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyR8�s

cC@sIidd6}t|�j}|r/||d<n|rE|j|�n|S(s�
        Sets headers needed by proxies: specifically, the Accept and Host
        headers. Only sets headers not provided by the user.
        s*/*tAccepttHost(R
tnetloctupdate(RR9R!theaders_R_((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyt_set_proxy_headerss

cK@skt|�}|jdkrI|jd|j�}|j||�|d<ntt|�j||d||�S(s@Same as HTTP(S)ConnectionPool.urlopen, ``url`` must be absolute.RR!R=(R
R-R4R!RbR[R
RC(RROR9R=R2R:R!((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyRCs
N(	RSRTRUR,RR8RbRVRC(((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyR
�scK@std||�S(NR\(R
(R9R2((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyR$s(RRRRRR( t
__future__Rtloggingturllib.parseRtImportErrorturlparset_collectionsRtconnectionpoolRRRt
exceptionsRRRtrequestR	tutil.urlR
t
util.retryRt__all__t	getLoggerRSRMR*RRR
R(((sU/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.pyt<module>s,

�W

MMCT - 2023