Mini Kabibi Habibi

Current Path : C:/Users/ITO/AppData/Local/Programs/GIMP 2/lib/python2.7/site-packages/urllib3/
Upload File :
Current File : C:/Users/ITO/AppData/Local/Programs/GIMP 2/lib/python2.7/site-packages/urllib3/response.pyc

�
O��]c@@s�ddlmZddlmZddlZddlZddlZddlmZ	ddlm
ZyddlZWne
k
r�dZnXddlmZddlmZmZmZmZmZmZmZdd	lmZmZdd
lmZddl m!Z!m"Z"ddl#m$Z$m%Z%ej&e'�Z(d
e)fd��YZ*de)fd��YZ+de)fd��YZ,edk	r�de)fd��YZ-nde)fd��YZ.d�Z/dej0fd��YZ1dS(i(tabsolute_import(tcontextmanagerN(ttimeout(terrori(tHTTPHeaderDict(tBodyNotHttplibCompatiblet
ProtocolErrortDecodeErrortReadTimeoutErrortResponseNotChunkedtIncompleteReadt
InvalidHeader(tstring_typestPY3(thttp_client(t
HTTPExceptiontBaseSSLError(tis_fp_closedtis_response_to_headtDeflateDecodercB@s#eZd�Zd�Zd�ZRS(cC@s%t|_d|_tj�|_dS(Nt(tTruet
_first_tryt_datatzlibt
decompressobjt_obj(tself((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt__init__!s		cC@st|j|�S(N(tgetattrR(Rtname((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt__getattr__&scC@s�|s
|S|js#|jj|�S|j|7_y5|jj|�}|rbt|_d|_n|SWnTtjk
r�t|_tjtj	�|_z|j|j�SWdd|_XnXdS(N(
RRt
decompressRtFalsetNoneRRRt	MAX_WBITS(Rtdatatdecompressed((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR )s"			(t__name__t
__module__RRR (((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR s		tGzipDecoderStatecB@seZdZdZdZRS(iii(R&R'tFIRST_MEMBERt
OTHER_MEMBERStSWALLOW_DATA(((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR(@stGzipDecodercB@s#eZd�Zd�Zd�ZRS(cC@s)tjdtj�|_tj|_dS(Ni(RRR#RR(R)t_state(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyRHscC@st|j|�S(N(RR(RR((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyRLscC@s�t�}|jtjks"|r,t|�Sx�tr�y||jj|�7}WnEtj	k
r�|j}tj|_|tj
kr�t|�S�nX|jj}|s�t|�Stj
|_tjdtj
�|_q/WdS(Ni(t	bytearrayR-R(R+tbytesRRR RRR*tunused_dataRR#(RR$trettprevious_state((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR Os"	
		

(R&R'RRR (((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR,Gs		t
BrotliDecodercB@s#eZd�Zd�Zd�ZRS(cC@stj�|_dS(N(tbrotlitDecompressorR(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyRkscC@s2t|jd�r"|jj|�S|jj|�S(NR (thasattrRR tprocess(RR$((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR nscC@s#t|jd�r|jj�SdS(NtflushR(R6RR8(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR8ss
(R&R'RR R8(((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR3gs		tMultiDecodercB@s)eZdZd�Zd�Zd�ZRS(s
    From RFC7231:
        If one or more encodings have been applied to a representation, the
        sender that applied the encodings MUST generate a Content-Encoding
        header field that lists the content codings in the order in which
        they were applied.
    cC@s5g|jd�D]}t|j��^q|_dS(Nt,(tsplitt_get_decodertstript	_decoders(Rtmodestm((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR�scC@s|jdj�S(Ni(R>R8(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR8�scC@s-x&t|j�D]}|j|�}qW|S(N(treversedR>R (RR$td((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR �s(R&R't__doc__RR8R (((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR9ys		cC@sOd|krt|�S|dkr)t�Stdk	rH|dkrHt�St�S(NR:tgziptbr(R9R,R4R"R3R(tmode((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR<�s
tHTTPResponsecB@s�eZdZddgZed+k	r4edg7ZndddddgZd	d+d
d
d+d
eed+d+d+d+d+ed+d+ed�Z	d�Z
d
�Zed��Z
ed��Zd�Zd�Zd�Zd�ZeejfZed+k	reejf7Znd�Zd�Zed��Zd+d+ed�Zd,d+d�Zed��Zd�Zd+d�Z d�Z!d�Z"ed ��Z#d!�Z$d"�Z%d#�Z&d$�Z'd%�Z(d&�Z)d'�Z*d+d+d(�Z+d)�Z,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, will attempt to decode the body based on the
        'content-encoding' header.

    :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.

    :param retries:
        The retries contains the last :class:`~urllib3.util.retry.Retry` that
        was used during the request.

    :param enforce_content_length:
        Enforce content length checking. Body returned by server must match
        value of Content-Length header, if present. Otherwise, raise error.
    RDtdeflateREi-i.i/i3i4RicC@s�t|t�r||_nt|�|_||_||_||_||_||_|
|_||_	||_
d|_d|_
d|_|	|_d|_||_||_|r�t|ttf�r�||_
n|
|_||_t|d�r||_nt|_d|_|jjdd�j�}d�|jd�D�}d|krct|_n|j|�|_ |r�|j
r�|j!d|�|_
ndS(	Nitreadstransfer-encodingRcs@s|]}|j�VqdS(N(R=(t.0tenc((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pys	<genexpr>�sR:tchunkedtdecode_content("t
isinstanceRtheaderststatustversiontreasontstrictRMtretriestenforce_content_lengtht
auto_closeR"t_decodert_bodyt_fpt_original_responset_fp_bytes_readtmsgt_request_urlt
basestringR/t_poolt_connectionR6R!RLt
chunk_lefttgettlowerR;Rt_init_lengthtlength_remainingRI(RtbodyRORPRQRRRStpreload_contentRMtoriginal_responsetpoolt
connectionR\RTRUtrequest_methodtrequest_urlRVttr_enct	encodings((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR�sB																			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(RPtREDIRECT_STATUSESRORbR!(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pytget_redirect_locationscC@s8|js|jrdS|jj|j�d|_dS(N(R_R`t	_put_connR"(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pytrelease_connscC@s-|jr|jS|jr)|jdt�SdS(Nt
cache_content(RXRYRIR(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR$s		cC@s|jS(N(R`(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyRj!scC@s
t|j�S(N(RRY(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pytisclosed%scC@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((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyttell(scC@s;|jjd�}|dk	r�|jr8tjd�dSyctg|jd�D]}t|�^qN�}t	|�dkr�t
d|��n|j�}Wntk
r�d}q�X|dkr�d}q�nyt|j
�}Wntk
r�d}nX|d
ks.d	|kod
kns.|dkr7d}n|S(sM
        Set initial length value for Response content if available.
        scontent-lengths�Received response with both Content-Length and Transfer-Encoding set. This is expressly forbidden by RFC 7230 sec 3.3.2. Ignoring Content-Length and attempting to process response as Transfer-Encoding: chunked.R:is8Content-Length contained multiple unmatching values (%s)ii�i0idi�tHEADN(i�i0(RORbR"RLtlogtwarningtsetR;tinttlenRtpopt
ValueErrorRP(RRktlengthtvaltlengthsRP((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyRd0s0	.




4	cC@s�|jjdd�j�}|jdkr�||jkrKt|�|_q�d|kr�g|jd�D]'}|j�|jkrg|j�^qg}t	|�r�t|�|_q�q�ndS(s=
        Set-up the _decoder attribute if necessary.
        scontent-encodingRR:N(
RORbRcRWR"tCONTENT_DECODERSR<R;R=R|(Rtcontent_encodingteRn((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt
_init_decoderds'cC@s�|s
|Sy"|jr+|jj|�}nWnD|jk
rr}|jjdd�j�}td||��nX|r�||j�7}n|S(sN
        Decode the data passed in and potentially flush the decoder.
        scontent-encodingRsEReceived response with content-encoding: %s, but failed to decode it.(RWR tDECODER_ERROR_CLASSESRORbRcRt_flush_decoder(RR$RMt
flush_decoderR�R�((s8/mingw64/lib/python2.7/site-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(RWR R8(Rtbuf((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR��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(R!t
SocketTimeoutRR_R"RtstrRtSocketErrorRRRZtcloseR`RuRs(Rt
clean_exitR�((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt_error_catcher�s(		

		cC@s�|j�|dkr"|j}n|jdkr5dSt}t|jdt�}|j���|dkr�|s~|jj�nd}t}n}t}|s�|jj|�nd}|dkr
|r
|jj	�t}|j
r
|jdkr
t|j
|j��q
nWdQX|r||j
t|�7_
|jdk	rR|jt|�8_n|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.)
        NtclosedRi(iN(R�R"RMRYR!RR�RIRR�RUReR
R[R|R�RX(RtamtRMRtR�t	fp_closedR$((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyRI�s8

		
	!iicc@s}|jr=|j�r=xa|j|d|�D]}|Vq+Wn<x9t|j�sx|jd|d|�}|r@|Vq@q@WdS(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.
        RMR�N(RLtsupports_chunked_readstread_chunkedRRYRI(RR�RMtlineR$((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pytstreams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``.
        RSiRfRORPRQRRRh(
R\RNRR
titemstfrom_httplibRRPRQRR(tResponseClstrtresponse_kwRORStresp((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR�9s 						cC@s|jS(N(RO(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt
getheadersZscC@s|jj||�S(N(RORb(RRtdefault((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt	getheader]scC@s|jS(N(RO(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pytinfoascC@sR|js|jj�n|jr2|jj�n|jsNtjj|�ndS(N(R�RYR�R`RVtiotIOBase(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR�es			cC@sr|jstjjj|�S|jdkr/tSt|jd�rN|jj	�St|jd�rj|jjStSdS(NRuR�(
RVR�R�R�t__get__RYR"RR6Ru(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR�os	

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(RYR"tIOErrorR6R�(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR�|s
cC@sH|jdk	rDt|jd�rDt|jdt�rD|jj�SdS(NR8R�(RYR"R6RR!R8(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR8�scC@stS(N(R(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pytreadable�scC@sI|jt|��}t|�dkr+dS||t|�*t|�SdS(Ni(RIR|(Rtbttemp((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pytreadinto�s
cC@st|jd�S(s�
        Checks if the underlying file-like object looks like a
        httplib.HTTPResponse object. We do this by testing for the fp
        attribute. If it is present we assume it returns raw chunks as
        processed by read_chunked().
        tfp(R6RY(R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR��scC@s�|jdk	rdS|jjj�}|jdd�d}yt|d�|_Wn*tk
r}|j�t	j
|��nXdS(Nt;iii(RaR"RYR�treadlineR;R{R~R�thttplibR
(RR�((s8/mingw64/lib/python2.7/site-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"RYt
_safe_readRa(RR�treturned_chunktchunktvalue((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt
_handle_chunk�s&				c
c@sj|j�|js"td��n|j�s=td��n|j��|jrst|j�rs|jj�dS|j	j
dkr�dSx_tr�|j
�|jdkr�Pn|j|�}|j|d|dt�}|r�|Vq�q�W|r|j�}|r|Vqnx6trF|j	j
j�}|s3Pn|dkrPqqW|jr`|jj�nWdQXdS(s�
        Similar to :meth:`HTTPResponse.read`, but with an additional
        parameter: ``decode_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.
        sHResponse is not chunked. Header 'transfer-encoding: chunked' is missing.sgBody should be httplib.HTTPResponse like. It should have have an fp attribute which returns raw chunks.NiRMR�s
(R�RLR	R�RR�RZRR�RYR�R"RR�RaR�R�R!R�R�(RR�RMR�tdecodedR�((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyR��sD
	

	
		cC@s=|jdk	r2t|jj�r2|jjdjS|jSdS(s�
        Returns the URL that was the source of this response.
        If the request that generated this response redirected, this method
        will return the final redirect location.
        i����N(RTR"R|thistorytredirect_locationR](R((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pytgeturls!cc@s�dg}x�|jdt�D]�}d|kr�|jd�}dj|�|ddVx|dd!D]}|dVqeW|dr�|dg}q�g}q|j|�qW|r�dj|�VndS(NRRMs
iii����(R�RR;tjointappend(RtbufferR�tx((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt__iter__s	

	Ni(.R&R'RCR�R4R"RpRR!RRqRstpropertyR$RjRuRvRdR�R�RRR�R�R�RR�RIR�tclassmethodR�R�R�R�R�R�R�R8R�R�R�R�R�R�R�R�(((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyRG�sl1	
					4			9J!			

									F	(2t
__future__Rt
contextlibRRR�tloggingtsocketRR�RR�R4tImportErrorR"t_collectionsRt
exceptionsRRRRR	R
Rtpackages.sixRR^R
tpackages.six.movesRR�RjRRt
util.responseRRt	getLoggerR&RxtobjectRR(R,R3R9R<R�RG(((s8/mingw64/lib/python2.7/site-packages/urllib3/response.pyt<module>s2

4