/opt/alt/python37/lib/python3.7/site-packages/urllib3/__pycache__
NameSizeModeActions
connection.cpython-37.opt-1.pyc132090644editdlrm
connection.cpython-37.pyc132090644editdlrm
connectionpool.cpython-37.opt-1.pyc244020644editdlrm
connectionpool.cpython-37.pyc244020644editdlrm
exceptions.cpython-37.opt-1.pyc120130644editdlrm
exceptions.cpython-37.pyc120130644editdlrm
fields.cpython-37.opt-1.pyc81030644editdlrm
fields.cpython-37.pyc81030644editdlrm
filepost.cpython-37.opt-1.pyc27210644editdlrm
filepost.cpython-37.pyc27210644editdlrm
poolmanager.cpython-37.opt-1.pyc149890644editdlrm
poolmanager.cpython-37.pyc149890644editdlrm
request.cpython-37.opt-1.pyc55210644editdlrm
request.cpython-37.pyc55210644editdlrm
response.cpython-37.opt-1.pyc205110644editdlrm
response.cpython-37.pyc205110644editdlrm
_collections.cpython-37.opt-1.pyc106710644editdlrm
_collections.cpython-37.pyc106710644editdlrm
_version.cpython-37.opt-1.pyc1740644editdlrm
_version.cpython-37.pyc1740644editdlrm
__init__.cpython-37.opt-1.pyc21420644editdlrm
__init__.cpython-37.pyc21420644editdlrm
Edit: /opt/alt/python37/lib/python3.7/site-packages/urllib3/__pycache__/response.cpython-37.pyc (20511B)
B ØÕ`+nã@sXddlmZddlZddlZddlZddlmZddlmZ ddlm Z y ddl Z Wne k rldZ YnXddlmZddlmZmZdd lmZmZmZmZmZmZmZmZmZmZdd lmZdd l m!Z!m"Z"e #e$¡Z%Gd d „d e&ƒZ'Gdd„de&ƒZ(Gdd„de&ƒZ)e dk r*Gdd„de&ƒZ*Gdd„de&ƒZ+dd„Z,Gdd„dej-ƒZ.dS)é)Úabsolute_importN)Úcontextmanager)Úerror)Útimeouté)ÚHTTPHeaderDict)Ú BaseSSLErrorÚ HTTPException) ÚBodyNotHttplibCompatibleÚ DecodeErrorÚ HTTPErrorÚIncompleteReadÚInvalidChunkLengthÚ InvalidHeaderÚ ProtocolErrorÚReadTimeoutErrorÚResponseNotChunkedÚSSLError)Úsix)Ú is_fp_closedÚis_response_to_headc@s$eZdZdd„Zdd„Zdd„ZdS)ÚDeflateDecodercCsd|_d|_t ¡|_dS)NTó)Ú _first_tryÚ_dataÚzlibÚ decompressobjÚ_obj)Úself©rúA/opt/alt/python37/lib/python3.7/site-packages/urllib3/response.pyÚ__init__$szDeflateDecoder.__init__cCs t|j|ƒS)N)Úgetattrr)rÚnamerrr Ú __getattr__)szDeflateDecoder.__getattr__c Cs|s|S|js|j |¡S|j|7_y |j |¡}|rFd|_d|_|Stjk rŠd|_t tj ¡|_z | |j¡Sd|_XYnXdS)NF)rrÚ decompressrrrrÚ MAX_WBITS)rÚdataZ decompressedrrr r%,s"   zDeflateDecoder.decompressN)Ú__name__Ú __module__Ú __qualname__r!r$r%rrrr r#src@seZdZdZdZdZdS)ÚGzipDecoderStaterréN)r(r)r*Ú FIRST_MEMBERÚ OTHER_MEMBERSÚ SWALLOW_DATArrrr r+Csr+c@s$eZdZdd„Zdd„Zdd„ZdS)Ú GzipDecodercCst dtj¡|_tj|_dS)Né)rrr&rr+r-Ú_state)rrrr r!KszGzipDecoder.__init__cCs t|j|ƒS)N)r"r)rr#rrr r$OszGzipDecoder.__getattr__cCs¤tƒ}|jtjks|st|ƒSx€y||j |¡7}Wn8tjk rl|j}tj|_|tj krft|ƒS‚YnX|jj }|s‚t|ƒStj |_t  dtj ¡|_q WdS)Nr1) Ú bytearrayr2r+r/Úbytesrr%rrr.Z unused_datarr&)rr'ZretZprevious_staterrr r%Rs" zGzipDecoder.decompressN)r(r)r*r!r$r%rrrr r0Jsr0c@seZdZdd„Zdd„ZdS)Ú BrotliDecodercCs0t ¡|_t|jdƒr"|jj|_n |jj|_dS)Nr%)ÚbrotliZ DecompressorrÚhasattrr%Zprocess)rrrr r!ns   zBrotliDecoder.__init__cCst|jdƒr|j ¡SdS)NÚflushr)r7rr8)rrrr r8us  zBrotliDecoder.flushN)r(r)r*r!r8rrrr r5jsr5c@s(eZdZdZdd„Zdd„Zdd„ZdS) Ú MultiDecodera 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. cCsdd„| d¡Dƒ|_dS)NcSsg|]}t| ¡ƒ‘qSr)Ú _get_decoderÚstrip)Ú.0Úmrrr ú …sz)MultiDecoder.__init__..ú,)ÚsplitÚ _decoders)rZmodesrrr r!„szMultiDecoder.__init__cCs|jd ¡S)Nr)rAr8)rrrr r8‡szMultiDecoder.flushcCs"xt|jƒD]}| |¡}q W|S)N)ÚreversedrAr%)rr'Údrrr r%ŠszMultiDecoder.decompressN)r(r)r*Ú__doc__r!r8r%rrrr r9{sr9cCs:d|krt|ƒS|dkrtƒStdk r4|dkr4tƒStƒS)Nr?ÚgzipÚbr)r9r0r6r5r)Úmoderrr r:sr:c@sleZdZdZddgZedk r&edg7Zdddd d gZdNdd„Zdd„Zdd„Z dd„Z e dd„ƒZ e dd„ƒZ dd„Zdd„Zdd „Zd!d"„ZeejfZedk r¬eejf7Zd#d$„Zd%d&„Zed'd(„ƒZdOd)d*„ZdPd,d-„Zed.d/„ƒZd0d1„ZdQd2d3„Zd4d5„Z d6d7„Z!e d8d9„ƒZ"d:d;„Z#dd?„Z%d@dA„Z&dBdC„Z'dDdE„Z(dFdG„Z)dRdHdI„Z*dJdK„Z+dLdM„Z,dS)SÚ HTTPResponseaá HTTP Response container. Backwards-compatible with :class:`http.client.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 :class:`http.client.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 :class:`http.client.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. rEZdeflateNrFi-i.i/i3i4ÚrTFcCst|tƒr||_n t|ƒ|_||_||_||_||_||_| |_||_ ||_ d|_ d|_ d|_ | |_d|_| |_||_|rt|tjtfƒr||_ | |_| |_t|dƒr¬||_ d|_d|_|j dd¡ ¡}dd„| d¡Dƒ}d |krìd |_| |¡|_|r|j s|j|d |_ dS) NrÚreadFztransfer-encodingrIcss|]}| ¡VqdS)N)r;)r<Úencrrr ú ûsz(HTTPResponse.__init__..r?ÚchunkedT)Údecode_content) Ú isinstancerÚheadersÚstatusÚversionÚreasonÚstrictrNÚretriesÚenforce_content_lengthÚ auto_closeÚ_decoderÚ_bodyÚ_fpÚ_original_responseÚ_fp_bytes_readÚmsgÚ _request_urlrZ string_typesr4Ú_poolÚ _connectionr7rMÚ chunk_leftÚgetÚlowerr@Ú _init_lengthÚlength_remainingrJ)rÚbodyrPrQrRrSrTZpreload_contentrNÚoriginal_responseZpoolÚ connectionr]rUrVÚrequest_methodZ request_urlrWZtr_encÚ encodingsrrr r!ÃsB    zHTTPResponse.__init__cCs|j|jkr|j d¡SdS)a 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. ÚlocationF)rQÚREDIRECT_STATUSESrPrb)rrrr Úget_redirect_locations  z"HTTPResponse.get_redirect_locationcCs(|jr |jsdS|j |j¡d|_dS)N)r_r`Z _put_conn)rrrr Ú release_conns zHTTPResponse.release_connc Cs.y | ¡Wnttttfk r(YnXdS)zÏ Read and discard any remaining HTTP response data in the response connection. Unread data in the HTTPResponse connection blocks the connection from being released back to the pool. N)rJr Ú SocketErrorrr )rrrr Ú drain_conns zHTTPResponse.drain_conncCs"|jr |jS|jr|jddSdS)NT)Ú cache_content)rYrZrJ)rrrr r'%szHTTPResponse.datacCs|jS)N)r`)rrrr rh.szHTTPResponse.connectioncCs t|jƒS)N)rrZ)rrrr Úisclosed2szHTTPResponse.isclosedcCs|jS)zì Obtain the number of bytes pulled over the wire so far. May differ from the amount of content returned by :meth:``urllib3.response.HTTPResponse.read`` if bytes are encoded on the wire (e.g, compressed). )r\)rrrr Útell5szHTTPResponse.tellcCsà|j d¡}|dk rŠ|jr(t d¡dSyWsz-HTTPResponse._init_length..r?rz8Content-Length contained multiple unmatching values (%s)r)éÌi0édéÈZHEAD) rPrbrMÚlogZwarningÚsetr@ÚlenrÚpopÚ ValueErrorrtrQ)rriÚlengthZlengthsrQrrr rd=s0     &zHTTPResponse._init_lengthcshˆj dd¡ ¡}ˆjdkrd|ˆjkr2t|ƒˆ_n2d|krd‡fdd„| d¡Dƒ}t|ƒrdt|ƒˆ_dS)z= Set-up the _decoder attribute if necessary. zcontent-encodingrINr?cs"g|]}| ¡ˆjkr| ¡‘qSr)r;ÚCONTENT_DECODERS)r<Úe)rrr r>}sz.HTTPResponse._init_decoder..)rPrbrcrXrr:r@r{)rÚcontent_encodingrjr)rr Ú _init_decoderqs    zHTTPResponse._init_decoderc Csx|s|Sy|jr|j |¡}WnD|jk rb}z$|j dd¡ ¡}td||ƒ‚Wdd}~XYnX|rt|| ¡7}|S)zN Decode the data passed in and potentially flush the decoder. zcontent-encodingrIzEReceived response with content-encoding: %s, but failed to decode it.N)rXr%ÚDECODER_ERROR_CLASSESrPrbrcr Ú_flush_decoder)rr'rNÚ flush_decoderr€rrrr Ú_decodeˆs zHTTPResponse._decodecCs$|jr |j d¡}||j ¡SdS)zk Flushes the decoder. Should only be called if the decoder is actually being used. r)rXr%r8)rZbufrrr r„žs zHTTPResponse._flush_decoderc csòd}zªy dVWn–tk r2t|jddƒ‚Ynvtk rt}z&dt|ƒkrVt|ƒ‚t|jddƒ‚Wdd}~XYn4ttfk r¦}ztd||ƒ‚Wdd}~XYnXd}Wd|sÔ|j rÄ|j   ¡|j rÔ|j   ¡|j rì|j   ¡rì|  ¡XdS)zç 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. FNzRead timed out.zread operation timed outzConnection broken: %rT)Ú SocketTimeoutrr_rÚstrrr rorr[Úcloser`rrrn)rZ clean_exitr€rrr Ú_error_catcher©s(      zHTTPResponse._error_catcherc Cs | ¡|dkr|j}|jdkr$dSd}t|jddƒ}| ¡v|dkr`|sV|j ¡nd}d}nPd}|st|j |¡nd}|dkr°|s°|j ¡d}|jr°|jdkr°t |j |jƒ‚WdQRX|r|j t |ƒ7_ |jdk rî|jt |ƒ8_|  |||¡}|r||_ |S)aT Similar to :meth:`http.client.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.) NFÚclosedrTr)rN)r‚rNrZr"rŠrJr‰rVrer r\r{r†rY)rÚamtrNrqr…Z fp_closedr'rrr rJás6     zHTTPResponse.readéccsZ|jr.| ¡r.xF|j||dD] }|VqWn(x&t|jƒsT|j||d}|r0|Vq0WdS)a_ 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. )rN)rŒrNN)rMÚsupports_chunked_readsÚ read_chunkedrrZrJ)rrŒrNÚliner'rrr Ústream+s  zHTTPResponse.streamc Ksb|j}t|tƒs.tjr"t |¡}n t| ¡ƒ}t|ddƒ}|f|||j|j |j ||dœ|—Ž}|S)a Given an :class:`http.client.HTTPResponse` instance ``r``, return a corresponding :class:`urllib3.response.HTTPResponse` object. Remaining parameters are passed to the HTTPResponse constructor, along with ``original_response=r``. rTr)rfrPrQrRrSrTrg) r]rOrrZPY2Ú from_httplibÚitemsr"rQrRrS)Z ResponseClsÚrZ response_kwrPrTZresprrr r’Es     zHTTPResponse.from_httplibcCs|jS)N)rP)rrrr Ú getheadersfszHTTPResponse.getheaderscCs|j ||¡S)N)rPrb)rr#Údefaultrrr Ú getheaderiszHTTPResponse.getheadercCs|jS)N)rP)rrrr ÚinfomszHTTPResponse.infocCs6|js|j ¡|jr |j ¡|js2tj |¡dS)N)r‹rZr‰r`rWÚioÚIOBase)rrrr r‰qs   zHTTPResponse.closecCsT|jstjj |¡S|jdkr"dSt|jdƒr8|j ¡St|jdƒrL|jjSdSdS)NTrrr‹)rWr™ršr‹Ú__get__rZr7rr)rrrr r‹{s    zHTTPResponse.closedcCs6|jdkrtdƒ‚nt|jdƒr*|j ¡Stdƒ‚dS)Nz-HTTPResponse has no file to get a fileno fromÚfilenozOThe file-like object this HTTPResponse is wrapped around has no file descriptor)rZÚIOErrorr7rœ)rrrr rœˆs     zHTTPResponse.filenocCs2|jdk r.t|jdƒr.t|jddƒs.|j ¡SdS)Nr8r‹F)rZr7r"r8)rrrr r8“s  zHTTPResponse.flushcCsdS)NTr)rrrr Úreadable›szHTTPResponse.readablecCs:| t|ƒ¡}t|ƒdkrdS||dt|ƒ…<t|ƒSdS)Nr)rJr{)rÚbZtemprrr ÚreadintoŸs  zHTTPResponse.readintocCs t|jdƒS)a Checks if the underlying file-like object looks like a :class:`http.client.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(). Úfp)r7rZ)rrrr rލsz#HTTPResponse.supports_chunked_readscCsf|jdk rdS|jj ¡}| dd¡d}yt|dƒ|_Wn&tk r`| ¡t||ƒ‚YnXdS)Nó;rrr1) rarZr¡Úreadliner@rtr}r‰r)rrrrr Ú_update_chunk_length±s  z!HTTPResponse._update_chunk_lengthcCs¬d}|dkr2|j |j¡}|}|j d¡d|_nv||jkrZ|j |¡}|j||_|}nN||jkrˆ|j |¡}|j d¡d|_|}n |j |j¡}|j d¡d|_|S)Nr,)rZZ _safe_readra)rrŒZreturned_chunkÚchunkÚvaluerrr Ú _handle_chunk¿s&        zHTTPResponse._handle_chunkc csò| ¡|jstdƒ‚| ¡s&tdƒ‚| ¡º|jrNt|jƒrN|j ¡dS|j j dkr^dSx<|  ¡|j dkrtP|  |¡}|j||dd}|r`|Vq`W|r²| ¡}|r²|Vx |j j  ¡}|sÆP|dkr´Pq´W|jrä|j ¡WdQRXdS)aÆ 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. zHResponse is not chunked. Header 'transfer-encoding: chunked' is missing.zkBody should be http.client.HTTPResponse like. It should have have an fp attribute which returns raw chunks.NrF)rNr…s )r‚rMrrŽr rŠr[rr‰rZr¡r¤rar§r†r„r£)rrŒrNr¥Zdecodedrrrr rÕsD        zHTTPResponse.read_chunkedcCs.|jdk r$t|jjƒr$|jjdjS|jSdS)zÄ 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. Néÿÿÿÿ)rUr{ÚhistoryZredirect_locationr^)rrrr ÚgeturlszHTTPResponse.geturlccsœg}x‚|jddD]r}d|krz| d¡}d |¡|ddVx|dd…D]}|dVqNW|drt|dg}q„g}q| |¡qW|r˜d |¡VdS)NT)rNó rrrr¨)r‘r@ÚjoinÚappend)rÚbufferr¥Úxrrr Ú__iter__&s  zHTTPResponse.__iter__)rINrrNrTTNNNNNFNNT)NNF)rN)N)NN)-r(r)r*rDrr6rlr!rmrnrpÚpropertyr'rhrrrsrdr‚rrrrƒr†r„rrŠrJr‘Ú classmethodr’r•r—r˜r‰r‹rœr8ržr rŽr¤r§rrªr°rrrr rHsn  1  4   8 J  !      F rH)/Z __future__rr™ZloggingrÚ contextlibrZsocketrrorr‡r6Ú ImportErrorÚ _collectionsrrhrr Ú exceptionsr r r r rrrrrrZpackagesrZ util.responserrZ getLoggerr(ryÚobjectrr+r0r5r9r:ršrHrrrr Ús0       0