ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ nf\c@@sddlmZddlmZddlZddlZddlZddlmZ ddlm Z ddl m Z ddlmZmZmZmZmZmZmZdd lmZmZdd lmZdd lmZmZdd l m!Z!m"Z"ej#e$Z%d e&fdYZ'de&fdYZ(de&fdYZ)de&fdYZ*dZ+dej,fdYZ-dS(i(tabsolute_import(tcontextmanagerN(ttimeout(terrori(tHTTPHeaderDict(tBodyNotHttplibCompatiblet ProtocolErrort DecodeErrortReadTimeoutErrortResponseNotChunkedtIncompleteReadt InvalidHeader(t string_typestPY3(t http_client(t HTTPExceptiont BaseSSLError(t is_fp_closedtis_response_to_headtDeflateDecodercB@s#eZdZdZdZRS(cC@s%t|_d|_tj|_dS(Nt(tTruet _first_tryt_datatzlibt decompressobjt_obj(tself((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt__init__s  cC@st|j|S(N(tgetattrR(Rtname((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt __getattr__scC@s|s |S|js#|jj|S|j|7_y5|jj|}|rbt|_d|_n|SWnTtjk rt|_tjtj |_z|j|jSWdd|_XnXdS(N( RRt decompressRtFalsetNoneRRRt MAX_WBITS(Rtdatat decompressed((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR s"    (t__name__t __module__RRR (((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRs  tGzipDecoderStatecB@seZdZdZdZRS(iii(R&R't FIRST_MEMBERt OTHER_MEMBERSt SWALLOW_DATA(((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR(7st GzipDecodercB@s#eZdZdZdZRS(cC@s)tjdtj|_tj|_dS(Ni(RRR#RR(R)t_state(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR@scC@st|j|S(N(RR(RR((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRDscC@st}|jtjks"| r,t|Sxtry||jj|7}WnEtj k r|j}tj|_|tj krt|SnX|jj }|st|Stj |_tj dtj |_q/WdS(Ni(t bytearrayR-R(R+tbytesRRR RRR*t unused_dataRR#(RR$trettprevious_state((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR Gs"         (R&R'RRR (((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR,>s  t MultiDecodercB@s)eZdZdZdZdZRS(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|jdD]}t|j^q|_dS(Nt,(tsplitt _get_decodertstript _decoders(Rtmodestm((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRfscC@s|jdjS(Ni(R8tflush(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR;iscC@s-x&t|jD]}|j|}qW|S(N(treversedR8R (RR$td((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR ls(R&R't__doc__RR;R (((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR3]s  cC@s0d|krt|S|dkr)tStS(NR4tgzip(R3R,R(tmode((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR6rs    t HTTPResponsecB@seZdZddgZdddddgZdd)d d d)d eed)d)d)d)d)ed)d)d Zd Z d Z e d Z e dZ dZdZdZdZdZdZedZd)d)edZd*d)dZedZdZd)dZdZdZe dZd Zd!Z d"Z!d#Z"d$Z#d%Z$d&Z%d)d)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. R?tdeflatei-i.i/i3i4RicC@st|tr||_nt||_||_||_||_||_||_| |_||_ d|_ d|_ d|_ | |_d|_| |_||_|rt|ttfr||_ n| |_| |_t|dr||_ nt|_d|_|jjddj}d|jdD}d|krZt|_n|j||_|r|j r|j d||_ ndS( Nitreadstransfer-encodingRcs@s|]}|jVqdS(N(R7(t.0tenc((s4/usr/lib/python2.7/site-packages/urllib3/response.pys sR4tchunkedtdecode_content(!t isinstanceRtheaderststatustversiontreasontstrictRGtretriestenforce_content_lengthR"t_decodert_bodyt_fpt_original_responset_fp_bytes_readtmsgt _request_urlt basestringR/t_poolt _connectionthasattrR!RFt chunk_lefttgettlowerR5Rt _init_lengthtlength_remainingRC(RtbodyRIRJRKRLRMtpreload_contentRGtoriginal_responsetpoolt connectionRURNROtrequest_methodt request_urlttr_enct encodings((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRs@                       cC@s&|j|jkr"|jjdStS(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(RJtREDIRECT_STATUSESRIR\R!(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pytget_redirect_locationscC@s8|j s|j rdS|jj|jd|_dS(N(RXRYt _put_connR"(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt release_connscC@s-|jr|jS|jr)|jdtSdS(Nt cache_content(RQRRRCR(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR$s  cC@s|jS(N(RY(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRdscC@s t|jS(N(RRR(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pytisclosedscC@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). (RT(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyttellscC@s;|jjd}|d k r|jr8tjdd Syctg|jdD]}t|^qN}t |dkrt d|n|j }Wnt k rd }qX|dkrd }qnyt|j }Wnt k rd}nX|d ks.d |kod kns.|d kr7d}n|S(sM Set initial length value for Response content if available. scontent-lengthsReceived 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.R4is8Content-Length contained multiple unmatching values (%s)iii0iditHEADN(ii0(RIR\R"RFtlogtwarningtsetR5tinttlenR tpopt ValueErrorRJ(RRetlengthtvaltlengthsRJ((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR^s,   .       4 cC@s|jjddj}|jdkr||jkrKt||_qd|krg|jdD]'}|j|jkrg|j^qg}t |rt||_qqndS(s= Set-up the _decoder attribute if necessary. scontent-encodingRR4N( RIR\R]RPR"tCONTENT_DECODERSR6R5R7Rv(Rtcontent_encodingteRh((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt _init_decoder/s = cC@sy(|r'|jr'|jj|}nWnJttjfk rt}|jjddj}td||nX|r|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.( RPR tIOErrorRRRIR\R]Rt_flush_decoder(RR$RGt flush_decoderR~R}((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt_decode>s cC@s0|jr,|jjd}||jjSdS(sk Flushes the decoder. Should only be called if the decoder is actually being used. R(RPR R;(Rtbuf((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRPs cc@st}zy dVWntk r:t|jddnktk ry}dt|krant|jddn,ttfk r}t d||nXt }Wd|s|j r|j j n|j r|j j qn|j r|j jr|jnXdS(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 SocketTimeoutRRXR"RtstrRt SocketErrorRRRStcloseRYRoRm(Rt clean_exitR~((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt_error_catcher[s(      cC@sY|j|dkr"|j}n|jdkr5dSt}d}|j|dkrr|jj}t}nqt}|jj|}|dkr| r|jjt}|j r|j dkrt |j |j qnWdQX|rU|j t |7_ |j dk r+|j t |8_ n|j|||}|rU||_qUn|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(iN(RR"RGRRR!RRCRRROR_R RTRvRRQ(RtamtRGRnRR$((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRCs4       !iicc@s}|jr=|jr=xa|j|d|D] }|Vq+Wn<x9t|jsx|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. RGRN(RFtsupports_chunked_readst read_chunkedRRRRC(RRRGtlineR$((s4/usr/lib/python2.7/site-packages/urllib3/response.pytstreams cK@s|j}t|tsEtr3t|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``. RMiR`RIRJRKRLRb( RURHRR titemst from_httplibRRJRKRL(t ResponseClstrt response_kwRIRMtresp((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRs      cC@s|jS(N(RI(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt getheadersscC@s|jj||S(N(RIR\(RRtdefault((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt getheaderscC@s|jS(N(RI(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pytinfoscC@s6|js|jjn|jr2|jjndS(N(tclosedRRRRY(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRs  cC@sV|jdkrtSt|jdr2|jjSt|jdrN|jjStSdS(NRoR(RRR"RRZRoR(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR#s  cC@sM|jdkrtdn+t|jdr=|jjStddS(Ns-HTTPResponse has no file to get a fileno fromtfilenosOThe file-like object this HTTPResponse is wrapped around has no file descriptor(RRR"RRZR(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR.s  cC@s2|jdk r.t|jdr.|jjSdS(NR;(RRR"RZR;(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyR;7s!cC@stS(N(R(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pytreadable;scC@sI|jt|}t|dkr+dS||t|*t|SdS(Ni(RCRv(Rtbttemp((s4/usr/lib/python2.7/site-packages/urllib3/response.pytreadinto?s cC@st|jdS(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(RZRR(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRHscC@s|jdk rdS|jjj}|jddd}yt|d|_Wn*tk r}|jt j |nXdS(Nt;iii( R[R"RRRtreadlineR5RuRxRthttplibR (RR((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt_update_chunk_lengthQs  cC@sd}|dkrI|jj|j}|}|jjdd|_n||jkr|jj|}|j||_|}nq||jkr|jj|}|jjdd|_|}n.|jj|j}|jjdd|_|S(Ni(R"RRt _safe_readR[(RRtreturned_chunktchunktvalue((s4/usr/lib/python2.7/site-packages/urllib3/response.pyt _handle_chunk_s&      c c@sj|j|js"tdn|js=tdn|j|jrst|jrs|jjdS|j j dkrdSx_t r|j |jdkrPn|j|}|j|d|dt}|r|VqqW|r|j}|r|Vqnx6t rF|j j j}|s3Pn|dkrPqqW|jr`|jjnWdQXdS(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.NiRGRs (RRFR RRRRSRRRRRR"RRR[RRR!RR(RRRGRtdecodedR((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRusD                cC@s=|jdk r2t|jjr2|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. iN(RNR"Rvthistorytredirect_locationRV(R((s4/usr/lib/python2.7/site-packages/urllib3/response.pytgeturls!Ni((R&R'R>R|RjR"RR!RRkRmtpropertyR$RdRoRpR^RRRRRRCRt classmethodRRRRRRRR;RRRRRRR(((s4/usr/lib/python2.7/site-packages/urllib3/response.pyRA|sH   /     0   9E        C(.t __future__Rt contextlibRRtiotloggingtsocketRRRRt _collectionsRt exceptionsRRRRR R R t packages.sixR RWR tpackages.six.movesRRRdRRt util.responseRRt getLoggerR&RrtobjectRR(R,R3R6tIOBaseRA(((s4/usr/lib/python2.7/site-packages/urllib3/response.pyts&   4!