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/response.pyo
�
r2Wc@@s4ddlmZddlmZddlZddlZddlmZddlm	Z
ddlmZddl
mZmZmZmZdd	lmZmZmZdd
lmZddlmZmZddlmZmZd
e fd��YZ!de fd��YZ"d�Z#dej$fd��YZ%dS(i(tabsolute_import(tcontextmanagerN(ttimeout(terrori(tHTTPHeaderDict(t
ProtocolErrortDecodeErrortReadTimeoutErrortResponseNotChunked(tstring_typestbinary_typetPY3(thttp_client(t
HTTPExceptiontBaseSSLError(tis_fp_closedtis_response_to_headtDeflateDecodercB@s#eZd�Zd�Zd�ZRS(cC@s(t|_t�|_tj�|_dS(N(tTruet
_first_tryR
t_datatzlibt
decompressobjt_obj(tself((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt__init__s	cC@st|j|�S(N(tgetattrR(Rtname((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt__getattr__scC@s�|s
|S|js#|jj|�S|j|7_y|jj|�SWnTtjk
r�t|_tjtj�|_z|j|j�SWdd|_XnXdS(N(
RRt
decompressRRRtFalseRt	MAX_WBITStNone(Rtdata((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyRs		(t__name__t
__module__RRR(((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyRs		tGzipDecodercB@s#eZd�Zd�Zd�ZRS(cC@stjdtj�|_dS(Ni(RRRR(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR1scC@st|j|�S(N(RR(RR((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR4scC@s|s
|S|jj|�S(N(RR(RR!((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR7s(R"R#RRR(((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR$/s		cC@s|dkrt�St�S(Ntgzip(R$R(tmode((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt_get_decoder=stHTTPResponsecB@sOeZdZddgZdddddgZdd#d	d	d#d	eed#d#d#d
�Zd�Zd�Z	e
d
��Zd�Zd�Z
d�Zd�Zed��Zd#d#ed�Zd$d#d�Zed��Zd�Zd#d�Zd�Ze
d��Zd�Zd�Zd�Zd�Zd �Zd!�Z d#d#d"�Z!RS(%s�
    HTTP Response container.

    Backwards-compatible to httplib's HTTPResponse but the response ``body`` is
    loaded and decoded on-demand when the ``data`` property is accessed.  This
    class is also compatible with the Python standard library's :mod:`io`
    module, and can hence be treated as a readable object in the context of that
    framework.

    Extra parameters for behaviour not present in httplib.HTTPResponse:

    :param preload_content:
        If True, the response's body will be preloaded during construction.

    :param decode_content:
        If True, attempts to decode specific content-encoding's based on headers
        (like 'gzip' and 'deflate') will be skipped and raw data will be used
        instead.

    :param original_response:
        When this HTTPResponse wrapper is generated from an httplib.HTTPResponse
        object, it's convenient to include the original for debug purposes. It's
        otherwise unused.
    R%tdeflatei-i.i/i3i4ticC@sbt|t�r||_nt|�|_||_||_||_||_||_d|_	d|_
d|_|	|_d|_
|r�t|ttf�r�||_
n|
|_||_t|d�r�||_nt|_d|_|jjdd�j�}d�|jd�D�}
d|
kr6t|_n|r^|j
r^|jd|�|_
ndS(	Nitreadstransfer-encodingR*cs@s|]}|j�VqdS(N(tstrip(t.0tenc((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pys	<genexpr>�st,tchunkedtdecode_content(t
isinstanceRtheaderststatustversiontreasontstrictR1R t_decodert_bodyt_fpt_original_responset_fp_bytes_readt
basestringR
t_poolt_connectionthasattrRR0t
chunk_lefttgettlowertsplitRR+(RtbodyR3R4R5R6R7tpreload_contentR1toriginal_responsetpoolt
connectionttr_enct	encodings((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyRas6														cC@s&|j|jkr"|jjd�StS(s
        Should we redirect and where to?

        :returns: Truthy redirect location string if we got a redirect status
            code and valid location. ``None`` if redirect status and no
            location. ``False`` if not a redirect status code.
        tlocation(R4tREDIRECT_STATUSESR3RBR(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pytget_redirect_location�scC@s8|js|jrdS|jj|j�d|_dS(N(R>R?t	_put_connR (R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pytrelease_conn�scC@s-|jr|jS|jr)|jdt�SdS(Nt
cache_content(R9R:R+R(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR!�s		cC@s|jS(s�
        Obtain the number of bytes pulled over the wire so far. May differ from
        the amount of content returned by :meth:``HTTPResponse.read`` if bytes
        are encoded on the wire (e.g, compressed).
        (R<(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyttell�scC@sO|jjdd�j�}|jdkrK||jkrKt|�|_ndS(s<
        Set-up the _decoder attribute if necessar.
        scontent-encodingR*N(R3RBRCR8R tCONTENT_DECODERSR'(Rtcontent_encoding((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt
_init_decoder�scC@s�y(|r'|jr'|jj|�}nWnJttjfk
rt}|jjdd�j�}td||��nX|r�|r�||j	�7}n|S(sN
        Decode the data passed in and potentially flush the decoder.
        scontent-encodingR*sEReceived response with content-encoding: %s, but failed to decode it.(
R8RtIOErrorRRR3RBRCRt_flush_decoder(RR!R1t
flush_decoderteRT((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt_decode�scC@s0|jr,|jjd�}||jj�SdS(sk
        Flushes the decoder. Should only be called if the decoder is actually
        being used.
        R*(R8Rtflush(Rtbuf((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyRW�s	cc@st}z�y	dVWn�tk
r:t|jdd��nktk
ry}dt|�kra�nt|jdd��n,ttfk
r�}t	d||��nXt
}Wd|s�|jr�|jj�n|j
r�|j
j�q�n|jr|jj�r|j�nXdS(s�
        Catch low-level python exceptions, instead re-raising urllib3
        variants, so that low-level exceptions are not leaked in the
        high-level api.

        On exit, release the connection back to the pool.
        NsRead timed out.sread operation timed outsConnection broken: %r(Rt
SocketTimeoutRR>R RtstrR
tSocketErrorRRR;tcloseR?tisclosedRP(Rt
clean_exitRY((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt_error_catcher�s(		

		cC@s|j�|dkr"|j}n|jdkr5dSt}d}|j��j|dkrr|jj�}t}nAt}|jj|�}|dkr�|r�|jj�t}nWdQX|r�|j	t
|�7_	|j|||�}|r�||_q�n|S(sP
        Similar to :meth:`httplib.HTTPResponse.read`, but with two additional
        parameters: ``decode_content`` and ``cache_content``.

        :param amt:
            How much of the content to read. If specified, caching is skipped
            because it doesn't make sense to cache partial content as the full
            response.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.

        :param cache_content:
            If True, will save the returned data such that the same result is
            returned despite of the state of the underlying file object. This
            is useful if you want the ``.data`` property to continue working
            after having ``.read()`` the file object. (Overridden if ``amt`` is
            set.)
        Ni(
RUR R1R:RRcR+RR`R<tlenRZR9(RtamtR1RQRXR!((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR+s,

	
iicc@sq|jr1xa|j|d|�D]}|VqWn<x9t|j�sl|jd|d|�}|r4|Vq4q4WdS(s_
        A generator wrapper for the read() method. A call will block until
        ``amt`` bytes have been read from the connection or until the
        connection is closed.

        :param amt:
            How much of the content to read. The generator will return up to
            much data per iteration, but may return less. This is particularly
            likely when using compressed data. However, the empty string will
            never be returned.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        R1ReN(R0tread_chunkedRR:R+(RReR1tlineR!((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pytstreamLs	cK@s�|j}t|t�sEtr3t|j��}qEtj|�}nt|dd�}|d|d|d|jd|jd|j	d|d||�}|S(	s
        Given an :class:`httplib.HTTPResponse` instance ``r``, return a
        corresponding :class:`urllib3.response.HTTPResponse` object.

        Remaining parameters are passed to the HTTPResponse constructor, along
        with ``original_response=r``.
        R7iRER3R4R5R6RG(
tmsgR2RRtitemstfrom_httplibRR4R5R6(tResponseClstrtresponse_kwR3R7tresp((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyRkfs						cC@s|jS(N(R3(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt
getheaders�scC@s|jj||�S(N(R3RB(RRtdefault((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt	getheader�scC@s6|js|jj�n|jr2|jj�ndS(N(tclosedR:R`R?(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR`�s		cC@sV|jdkrtSt|jd�r/|jjSt|jd�rN|jj�StSdS(NRsRa(R:R RR@RsRa(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyRs�s

cC@sM|jdkrtd��n+t|jd�r=|jj�Std��dS(Ns-HTTPResponse has no file to get a fileno fromtfilenosOThe file-like object this HTTPResponse is wrapped around has no file descriptor(R:R RVR@Rt(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyRt�s

cC@s2|jdk	r.t|jd�r.|jj�SdS(NR[(R:R R@R[(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR[�s!cC@stS(N(R(R((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pytreadable�scC@sI|jt|��}t|�dkr+dS||t|�*t|�SdS(Ni(R+Rd(Rtbttemp((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pytreadinto�s
cC@s�|jdk	rdS|jjj�}|jdd�d}yt|d�|_Wn*tk
r}|j�t	j
|��nXdS(Nt;iii(RAR R:tfptreadlineRDtintt
ValueErrorR`thttplibtIncompleteRead(RRg((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt_update_chunk_length�s

cC@s�d}|dkrI|jj|j�}|}|jjd�d|_n�||jkr�|jj|�}|j||_|}nq||jkr�|jj|�}|jjd�d|_|}n.|jj|j�}|jjd�d|_|S(Ni(R R:t
_safe_readRA(RRetreturned_chunktchunktvalue((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt
_handle_chunk�s&				cc@s9|j�|js"td��n|jrKt|j�rK|jj�dS|j���x_tr�|j�|j	dkr~Pn|j
|�}|j|d|dt�}|r[|Vq[q[W|r�|j
�}|r�|Vq�nx6tr|jjj�}|sPn|dkr�Pq�q�W|jr/|jj�nWdQXdS(s�
        Similar to :meth:`HTTPResponse.read`, but with an additional
        parameter: ``decode_content``.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        sHResponse is not chunked. Header 'transfer-encoding: chunked' is missing.NiR1RXs
(RUR0RR;RR`RcRR�RAR�RZRRWR:RzR{(RReR1R�tdecodedRg((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyRf�s:	
	

	
			Ni("R"R#t__doc__RSRMR RRRNRPtpropertyR!RRRURZRWRRcRR+RhtclassmethodRkRpRrR`RsRtR[RuRxR�R�Rf(((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyR(Ds8	(	
				
		9<										(&t
__future__Rt
contextlibRRtiotsocketRR]RR_t_collectionsRt
exceptionsRRRRtpackages.sixR	R=R
Rtpackages.six.movesRR~RIR
Rt
util.responseRRtobjectRR$R'tIOBaseR((((sR/usr/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.pyt<module>s"	

MMCT - 2023