MMCT TEAM
Server IP : 111.118.215.189  /  Your IP : 18.225.254.235
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/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyc
�
>�P_c@s�dZddlZddlmZddlmZddlmZddlmZm	Z	m
Z
mZddlm
Z
mZmZmZdd	lmZmZmZdd
lmZmZddlmZmZmZddlmZmZmZm Z dd
l!m"Z"ddl#m$Z$ddl%m&Z&ddlm'Z'm(Z(m)Z)m*Z*m+Z+m,Z,ddl-m.Z.ddlm/Z/dZ0e	d�Z1e	d�Z2de3fd��YZ4de4fd��YZ5d�Z6dS(s�
requests.session
~~~~~~~~~~~~~~~~

This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).

i����N(tMapping(tdatetimei(t_basic_auth_str(t	cookielibtOrderedDictturljointurlparse(tcookiejar_from_dicttextract_cookies_to_jartRequestsCookieJart
merge_cookies(tRequesttPreparedRequesttDEFAULT_REDIRECT_LIMIT(t
default_hookst
dispatch_hook(tto_key_val_listtdefault_headerstto_native_string(tTooManyRedirectst
InvalidSchematChunkedEncodingErrortContentDecodingError(tRecentlyUsedContainer(tCaseInsensitiveDict(tHTTPAdapter(trequote_uritget_environ_proxiestget_netrc_authtshould_bypass_proxiestget_auth_from_urlt
DEFAULT_PORTS(tcodes(tREDIRECT_STATIi�cCs�|dkr|S|dkr |St|t�o;t|t�sB|S|t|��}|jt|��g|j�D]\}}|dkrt|^qt}x|D]
}||=q�W|S(s�
    Determines appropriate setting for a given request, taking into account the
    explicit setting on that request, and the setting in the session. If a
    setting is a dictionary, they will be merged together using `dict_class`
    N(tNonet
isinstanceRRtupdatetitems(trequest_settingtsession_settingt
dict_classtmerged_settingtktvt	none_keystkey((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyt
merge_setting*s1
cCsZ|dks!|jd�gkr%|S|dksF|jd�gkrJ|St|||�S(s�
    Properly merges both requests and session hooks.

    This is necessary because when request_hooks == {'response': []}, the
    merge breaks Session hooks entirely.
    tresponseN(R"tgetR.(t
request_hookst
session_hooksR(((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytmerge_hooksJs
!!tSessionRedirectMixincBsDeZd�Zededdd�Zd�Zd�Zd�Z	RS(cCs�t|�}t|�}|j|jkr.tS|jdkrn|jdkrn|jdkrn|jdkrntS|j|jk}|j|jk}tj|jd�df}|r�|j|kr�|j|kr�tS|p�|S(sFDecide whether Authorization header should be removed when redirectingthttpiPthttpsi�N(iPN(i�N(	RthostnametTruetschemetportR"tFalseRR0(tselftold_urltnew_urlt
old_parsedt
new_parsedtchanged_porttchanged_schemetdefault_port((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytshould_strip_auth[scks�d}	g}
x�|jr�|j�}|	dkrU|
j|�t|
�}||_ny|jWn-tttfk
r�|j	j
dt�nX|	|jkr�t
d|jd|��n|j�|jd}
|
jd�rt|j�}d|j|
f}
nt|
�}|j�}
|jsBt|jt|
��}
nt|
�}
t|
�|_|jr�|j|jkr�|j|j|j<n|j||�|jtjtjfkr�d|jkr�|jd=nd|_!n|j}y|d	=Wnt"k
rnXt#|j$||j	�|j$j%|j&�|j'|j$�|j(||�}|j)||�|}|j*|d
|d|d|d
|d|dt|�}t#|j&||j	�|	d7}	|VqWdS(s6Receives a Response. Returns a generator of Responses.itdecode_contentsExceeded %s redirects.R/tlocations//s%s:%ssContent-LengthtCookietstreamttimeouttverifytcerttproxiestallow_redirectsiN(+tis_redirecttcopytappendtlistthistorytcontentRRtRuntimeErrortrawtreadR;t
max_redirectsRtclosetheaderst
startswithRturlR9tgeturltnetlocRRRtis_permanent_redirecttredirect_cachetrebuild_methodtstatus_codeR ttemporary_redirecttpermanent_redirectR"tbodytKeyErrorRt_cookiesR$tcookiestprepare_cookiestrebuild_proxiestrebuild_authtsend(R<tresptreqRHRIRJRKRLtadapter_kwargstithisttprepared_requesttnew_histR[tparsed_rurltparsedRY((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytresolve_redirectstsn


	
	
	
cCs{|j}|j}d|kr@|j|jj|�r@|d=n|jrUt|�nd}|dk	rw|j|�ndS(s�
        When being redirected we may want to strip authentication from the
        request to avoid leaking credentials. This method intelligently removes
        and reapplies authentication where possible to avoid credential loss.
        t
AuthorizationN(RYR[RDtrequestt	trust_envRR"tprepare_auth(R<RqR/RYR[tnew_auth((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyRj�s		$
cCs|j}|j}t|�j}|dk	r9|j�ni}|jr�t|�r�t|�}|j	|�}|r�|j
|||�q�nd|kr�|d=nyt||�\}	}
Wntk
r�d\}	}
nX|	r|
rt
|	|
�|d<n|S(s�
        This method re-evaluates the proxy configuration by considering the
        environment variables. If we are redirected to a URL covered by
        NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
        proxy keys for this URL (in case they were stripped by a previous
        redirect).

        This method also replaces the Proxy-Authorization header where
        necessary.
        sProxy-AuthorizationN(NN(RYR[RR9R"RORxRRR0t
setdefaultRReR(R<RqRLRYR[R9tnew_proxiestenviron_proxiestproxytusernametpassword((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyRi�s$		

cCs�|j}|jtjkr0|dkr0d}n|jtjkrW|dkrWd}n|jtjkr~|dkr~d}n||_dS(s�When being redirected we may want to change the method of the request
        based on certain specs or browser behavior.
        tHEADtGETtPOSTN(tmethodRaR t	see_othertfoundtmoved(R<RqR/R�((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyR`s				N(
t__name__t
__module__RDR;R"R8RuRjRiR`(((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyR4Zs	_		%tSessioncBseZdZddddddddd	d
ddd
g
Zd�Zd�Zd�Zd�Zd!d!d!d!d!d!d!e	d!d!d!d!d!d!d�Z
d�Zd�Zd�Z
d!d!d�Zd!d�Zd!d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �ZRS("s~A Requests session.

    Provides cookie persistence, connection-pooling, and configuration.

    Basic Usage::

      >>> import requests
      >>> s = requests.Session()
      >>> s.get('http://httpbin.org/get')
      <Response [200]>

    Or as a context manager::

      >>> with requests.Session() as s:
      >>>     s.get('http://httpbin.org/get')
      <Response [200]>
    RYRgtauthRLthookstparamsRJRKtprefetchtadaptersRHRxRWcCs�t�|_d|_i|_t�|_i|_t|_	t
|_d|_t
|_t
|_ti�|_t�|_|jdt��|jdt��tt�|_dS(Nshttps://shttp://(RRYR"R�RLRR�R�R;RHR8RJRKR
RWRxRRgRR�tmountRRtREDIRECT_CACHE_SIZER_(R<((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyt__init__>s								cCs|S(N((R<((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyt	__enter__uscGs|j�dS(N(RX(R<targs((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyt__exit__xscCs*|jpi}t|tj�s0t|�}nttt�|j�|�}|j}|jr�|r�|jr�t	|j
�}nt�}|jd|j
j�d|j
d|jd|jd|jdt|j|jdt�dt|j|j�d	t||j�d
|dt|j|j��
|S(sbConstructs a :class:`PreparedRequest <PreparedRequest>` for
        transmission and returns it. The :class:`PreparedRequest` has settings
        merged from the :class:`Request <Request>` instance and those of the
        :class:`Session`.

        :param request: :class:`Request` instance to prepare with this
            session's settings.
        R�R[tfilestdatatjsonRYR(R�R�RgR�(RgR#Rt	CookieJarRR
R	R�RxRR[RtprepareR�tupperR�R�R�R.RYRR�R3R�(R<RwRgtmerged_cookiesR�tp((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytprepare_request{s*								cCs�td|j�d|d|d|d|p-id|d|p?id|d	|d
|�
}|j|�}|poi}|j|j||
||�}i|	d6|
d6}|j|�|j||�}|S(
s�Constructs a :class:`Request <Request>`, prepares it and sends it.
        Returns :class:`Response <Response>` object.

        :param method: method for the new :class:`Request` object.
        :param url: URL for the new :class:`Request` object.
        :param params: (optional) Dictionary or bytes to be sent in the query
            string for the :class:`Request`.
        :param data: (optional) Dictionary, bytes, or file-like object to send
            in the body of the :class:`Request`.
        :param json: (optional) json to send in the body of the
            :class:`Request`.
        :param headers: (optional) Dictionary of HTTP Headers to send with the
            :class:`Request`.
        :param cookies: (optional) Dict or CookieJar object to send with the
            :class:`Request`.
        :param files: (optional) Dictionary of ``'filename': file-like-objects``
            for multipart encoding upload.
        :param auth: (optional) Auth tuple or callable to enable
            Basic/Digest/Custom HTTP Auth.
        :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 allow_redirects: (optional) Set to True by default.
        :type allow_redirects: bool
        :param proxies: (optional) Dictionary mapping protocol or protocol and
            hostname to the URL of the proxy.
        :param stream: (optional) whether to immediately download the response
            content. Defaults to ``False``.
        :param verify: (optional) whether the SSL cert will be verified.
            A CA_BUNDLE path can also be provided. Defaults to ``True``.
        :param cert: (optional) if String, path to ssl client cert file (.pem).
            If Tuple, ('cert', 'key') pair.
        :rtype: requests.Response
	R�R[RYR�R�R�R�R�RgR�RIRM(RR�R�tmerge_environment_settingsR[R$Rk(R<R�R[R�R�RYRgR�R�RIRMRLR�RHRJRKR�Rmtpreptsettingstsend_kwargsRl((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyRw�s*3	

cKs#|jdt�|jd||�S(s�Sends a GET request. Returns :class:`Response` object.

        :param url: URL for the new :class:`Request` object.
        :param \*\*kwargs: Optional arguments that ``request`` takes.
        RMR�(R{R8Rw(R<R[tkwargs((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyR0�scKs#|jdt�|jd||�S(s�Sends a OPTIONS request. Returns :class:`Response` object.

        :param url: URL for the new :class:`Request` object.
        :param \*\*kwargs: Optional arguments that ``request`` takes.
        RMtOPTIONS(R{R8Rw(R<R[R�((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytoptions�scKs#|jdt�|jd||�S(s�Sends a HEAD request. Returns :class:`Response` object.

        :param url: URL for the new :class:`Request` object.
        :param \*\*kwargs: Optional arguments that ``request`` takes.
        RMR�(R{R;Rw(R<R[R�((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytheadscKs|jd|d|d||�S(s�Sends a POST request. Returns :class:`Response` object.

        :param url: URL for the new :class:`Request` object.
        :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
        :param json: (optional) json to send in the body of the :class:`Request`.
        :param \*\*kwargs: Optional arguments that ``request`` takes.
        R�R�R�(Rw(R<R[R�R�R�((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytposts	cKs|jd|d||�S(s7Sends a PUT request. Returns :class:`Response` object.

        :param url: URL for the new :class:`Request` object.
        :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
        :param \*\*kwargs: Optional arguments that ``request`` takes.
        tPUTR�(Rw(R<R[R�R�((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytputscKs|jd|d||�S(s9Sends a PATCH request. Returns :class:`Response` object.

        :param url: URL for the new :class:`Request` object.
        :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`.
        :param \*\*kwargs: Optional arguments that ``request`` takes.
        tPATCHR�(Rw(R<R[R�R�((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytpatch'scKs|jd||�S(s�Sends a DELETE request. Returns :class:`Response` object.

        :param url: URL for the new :class:`Request` object.
        :param \*\*kwargs: Optional arguments that ``request`` takes.
        tDELETE(Rw(R<R[R�((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytdelete1scKs#|jd|j�|jd|j�|jd|j�|jd|j�t|t�rjtd��n|jdt	�}|j
d�}|j}|r�t�}xW|j
|jkr�|j|j
�|jj
|j
�}||kr�Pn||_
q�Wn|jd|j
�}tj�}	|j||�}
tj�|	|
_td||
|�}
|
jr�x-|
jD]}t|j|j|j�qkWnt|j||
j�|j|
||�}|r�g|D]}|^q�ng}
|
r|
jd	|
�|
j�}
|
|
_n|s|
jn|
S(
sSend a given PreparedRequest.RHRJRKRLs#You can only send PreparedRequests.RMR[R/i(R{RHRJRKRLR#Rt
ValueErrortpopR8R0R�tsetR[R_taddtget_adapterRtutcnowRktelapsedRRRRRgRwRURutinsertRS(R<RwR�RMRHR�tchecked_urlsR>tadaptertstarttrRltgenRR((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyRk:sF			 %
c	Cs�|jr�t|�pi}x*|j�D]\}}|j||�q(W|tks`|dkr�tjjd�p�tjjd�}q�nt	||j
�}t	||j�}t	||j�}t	||j
�}i|d6|d6|d6|d6S(s6Check the environment and merge it with some settings.tREQUESTS_CA_BUNDLEtCURL_CA_BUNDLERJRLRHRKN(RxRR%R{R8R"tostenvironR0R.RLRHRJRK(	R<R[RLRHRJRKtenv_proxiesR*R+((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyR��s	cCsMx6|jj�D]%\}}|j�j|�r|SqWtd|��dS(s=Returns the appropriate connection adapter for the given URL.s*No connection adapters were found for '%s'N(R�R%tlowerRZR(R<R[tprefixR�((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyR��scCs(x!|jj�D]}|j�qWdS(s+Closes all adapters and as such the sessionN(R�tvaluesRX(R<R+((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyRX�scCso||j|<g|jD]$}t|�t|�kr|^q}x'|D]}|jj|�|j|<qHWdS(skRegisters a connection adapter to a prefix.

        Adapters are sorted in descending order by key length.N(R�tlenR�(R<R�R�R*tkeys_to_moveR-((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyR��s
4
cs6t�fd��jD��}t�j�|d<|S(Nc3s'|]}|t�|d�fVqdS(N(tgetattrR"(t.0tattr(R<(sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pys	<genexpr>�sR_(tdictt	__attrs__R_(R<tstate((R<sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyt__getstate__�scCs||jdi�}x*|j�D]\}}t|||�qWtt�|_x'|j�D]\}}||j|<q[WdS(NR_(R�R%tsetattrRR�R_(R<R�R_R�tvaluetredirecttto((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyt__setstate__�sN(R�R�t__doc__R�R�R�R�R�R"R8RwR0R�R�R�R�R�R�RkR�R�RXR�R�R�(((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyR�%sH		7			)C	
	
	


			H		
			cCst�S(s2Returns a :class:`Session` for context-management.(R�(((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pytsession�s(7R�R�tcollectionsRRR�RtcompatRRRRRgRRR	R
tmodelsRRR
R�RRtutilsRRRt
exceptionsRRRRtpackages.urllib3._collectionsRt
structuresRR�RRRRRRRtstatus_codesR R!R�R.R3tobjectR4R�R�(((sA/usr/lib/python2.7/site-packages/pip/_vendor/requests/sessions.pyt<module>
s.""". ���

MMCT - 2023