/opt/alt/python27/lib/python2.7/site-packages/requests
NameSizeModeActions
packages/-0755rm
adapters.py186800644editdlrm
adapters.pyc172040644editdlrm
adapters.pyo172040644editdlrm
api.py57950644editdlrm
api.pyc66330644editdlrm
api.pyo66330644editdlrm
auth.py80750644editdlrm
auth.pyc90770644editdlrm
auth.pyo90770644editdlrm
certs.py6490644editdlrm
certs.pyc9230644editdlrm
certs.pyo9230644editdlrm
compat.py15490644editdlrm
compat.pyc17070644editdlrm
compat.pyo17070644editdlrm
cookies.py175640644editdlrm
cookies.pyc217090644editdlrm
cookies.pyo217090644editdlrm
exceptions.py27760644editdlrm
exceptions.pyc61210644editdlrm
exceptions.pyo61210644editdlrm
hooks.py7670644editdlrm
hooks.pyc12400644editdlrm
hooks.pyo12400644editdlrm
models.py295300644editdlrm
models.pyc264090644editdlrm
models.pyo264090644editdlrm
sessions.py248970644editdlrm
sessions.pyc205480644editdlrm
sessions.pyo205480644editdlrm
status_codes.py33150644editdlrm
status_codes.pyc46290644editdlrm
status_codes.pyo46290644editdlrm
structures.py30170644editdlrm
structures.pyc54450644editdlrm
structures.pyo54450644editdlrm
utils.py222280644editdlrm
utils.pyc216640644editdlrm
utils.pyo216640644editdlrm
__init__.py22150644editdlrm
__init__.pyc28680644editdlrm
__init__.pyo28680644editdlrm
Edit: /opt/alt/python27/lib/python2.7/site-packages/requests/models.pyc (26409B)
 #Wc@sgdZddlZddlZddlmZmZddlmZddlm Z ddl m Z ddl m Z mZmZdd lmZdd lmZdd lmZdd lmZmZmZmZdd lmZmZmZmZm Z m!Z!m"Z"ddl#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-ddl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9ddl.m:Z;ddl<m=Z=e=j>e=j?e=j@e=jAe=jBfZCdZDddZEdZFdeGfdYZHdeGfdYZIdeIfdYZJdeHeIfdYZKdeGfdYZLdS( s` requests.models ~~~~~~~~~~~~~~~ This module contains the primary objects that power Requests. iN(tBytesIOtUnsupportedOperationi(t default_hooks(tCaseInsensitiveDict(t HTTPBasicAuth(tcookiejar_from_dicttget_cookie_headert_copy_cookie_jar(t RequestField(tencode_multipart_formdata(t parse_url(t DecodeErrortReadTimeoutErrort ProtocolErrortLocationParseError(t HTTPErrort MissingSchemat InvalidURLtChunkedEncodingErrortContentDecodingErrortConnectionErrortStreamConsumedError( tguess_filenametget_auth_from_urlt requote_uritstream_decode_response_unicodetto_key_val_listtparse_header_linkst iter_slicestguess_json_utft super_lentto_native_string( t cookielibt urlunparseturlsplitt urlencodetstrtbytestStringIOtis_py2tchardett builtin_strt basestring(tjson(tcodesii iitRequestEncodingMixincBs5eZedZedZedZRS(cCssg}t|j}|j}|s-d}n|j||j}|rf|jd|j|ndj|S(sBuild the path URL to use.t/t?t(R"turltpathtappendtquerytjoin(tselfR1tpR2R4((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pytpath_url5s     cCst|ttfr|St|dr,|St|drg}xt|D]\}}t|tsyt|d r|g}nxl|D]d}|dk r|jt|tr|jdn|t|tr|jdn|fqqWqNWt |dt S|SdS(sEncode parameters in a piece of data. Will successfully encode parameters when passed as a dict or a list of 2-tuples. Order is retained if data is a list of 2-tuples but arbitrary if parameters are supplied as a dict. treadt__iter__sutf-8tdoseqN( t isinstanceR$R%thasattrRR*tNoneR3tencodeR#tTrue(tdatatresulttktvstv((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt_encode_paramsJs    !3c Cs]|stdnt|tr3tdng}t|pEi}t|pWi}x|D]\}}t|tst|d r|g}nx|D]}|d k rt|tst|}n|jt|tr|j dn|t|tr|j dn|fqqWqdWx|D] \}}d }d } t|t t frt |dkr|\} } qt |dkr|\} } }q|\} } }} nt|p|} |} t| tttfr| } n | j} td|d| d | d | } | jd ||j| q3Wt|\}}||fS( sBuild the body for a multipart/form-data request. Will successfully encode files when passed as a dict or a list of tuples. Order is retained if data is a list of tuples but arbitrary if parameters are supplied as a dict. The tuples may be 2-tuples (filename, fileobj), 3-tuples (filename, fileobj, contentype) or 4-tuples (filename, fileobj, contentype, custom_headers). sFiles must be provided.sData must not be a string.R:sutf-8iitnameRAtfilenametheaderst content_typeN(t ValueErrorR<R*RR=R>R%R$R3tdecodeR?ttupletlisttlenRt bytearrayR9Rtmake_multipartR (tfilesRAt new_fieldstfieldstfieldtvalRERCtfttfhtfntfptfdatatrftbodyRJ((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt _encode_filesesH    !3  !(t__name__t __module__tpropertyR8t staticmethodRFR^(((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR-4stRequestHooksMixincBseZdZdZRS(cCs||jkr"td|nt|tjrK|j|j|n0t|dr{|j|jd|DndS(sProperly register a hook.s1Unsupported event specified, with event name "%s"R:css'|]}t|tjr|VqdS(N(R<t collectionstCallable(t.0th((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pys sN(thooksRKR<RdReR3R=textend(R6teventthook((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt register_hooks cCs5y|j|j|tSWntk r0tSXdS(siDeregister a previously registered hook. Returns True if the hook existed, False if not. N(RhtremoveR@RKtFalse(R6RjRk((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pytderegister_hooks  (R_R`RlRo(((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRcs tRequestc BsGeZdZddddddddddd ZdZdZRS(sA user-created :class:`Request ` object. Used to prepare a :class:`PreparedRequest `, which is sent to the server. :param method: HTTP method to use. :param url: URL to send. :param headers: dictionary of headers to send. :param files: dictionary of {filename: fileobject} files to multipart upload. :param data: the body to attach to the request. If a dictionary is provided, form-encoding will take place. :param json: json for the body to attach to the request (if files or data is not specified). :param params: dictionary of URL parameters to append to the URL. :param auth: Auth handler or (user, pass) tuple. :param cookies: dictionary or CookieJar of cookies to attach to this request. :param hooks: dictionary of callback hooks, for internal usage. Usage:: >>> import requests >>> req = requests.Request('GET', 'http://httpbin.org/get') >>> req.prepare() c Cs|dkrgn|}|dkr*gn|}|dkrBin|}|dkrZin|}| dkrrin| } t|_x6t| jD]"\} } |jd| d| qW||_||_||_||_ ||_ | |_ ||_ ||_ ||_dS(NRjRk(R>RRhRNtitemsRltmethodR1RIRRRAR+tparamstauthtcookies( R6RrR1RIRRRARsRtRuRhR+RCRE((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt__init__s"         cCs d|jS(Ns(Rr(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt__repr__scCsqt}|jd|jd|jd|jd|jd|jd|jd|jd|j d |j d |j |S( sXConstructs a :class:`PreparedRequest ` for transmission and returns it.RrR1RIRRRAR+RsRtRuRh( tPreparedRequesttprepareRrR1RIRRRAR+RsRtRuRh(R6R7((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRys            N(R_R`t__doc__R>RvRwRy(((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRps   Rxc BseZdZdZddddddddddd ZdZdZdZdZ dZ ddZ d Z d d Z d Zd ZRS(sThe fully mutable :class:`PreparedRequest ` object, containing the exact bytes that will be sent to the server. Generated from either a :class:`Request ` object or manually. Usage:: >>> import requests >>> req = requests.Request('GET', 'http://httpbin.org/get') >>> r = req.prepare() >>> s = requests.Session() >>> s.send(r) cCs=d|_d|_d|_d|_d|_t|_dS(N(R>RrR1RIt_cookiesR]RRh(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRvs      c Csk|j||j|||j||j||j||| |j|||j| dS(s6Prepares the entire request with the given parameters.N(tprepare_methodt prepare_urltprepare_headerstprepare_cookiest prepare_bodyt prepare_autht prepare_hooks( R6RrR1RIRRRARsRtRuRhR+((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRy"s   cCs d|jS(Ns(Rr(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRw3scCsvt}|j|_|j|_|jdk r?|jjnd|_t|j|_|j|_|j |_ |S(N( RxRrR1RIR>tcopyRR{R]Rh(R6R7((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR6s   '  cCs7||_|jdk r3t|jj|_ndS(sPrepares the given HTTP method.N(RrR>Rtupper(R6Rr((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR|@s cCst|tr!|jd}ntr3t|n t|}d|krn|jjd rn||_dSy%t |\}}}}}}} Wn"t k r} t | j nX|sd} | j t|d} t| n|st d|ny|jdjd}Wntk r?t d nX|pId } | r_| d 7} n| |7} |r| dt|7} n|sd }ntrCt|tr|jd}nt| tr| jd} nt|tr|jd}nt|tr|jd}nt| trC| jd} qCnt|ttfrgt|}n|j|} | r|rd || f}q| }ntt|| |d|| g}||_dS(sPrepares the given HTTP URL.tutf8t:thttpNsDInvalid URL {0!r}: No schema supplied. Perhaps you meant http://{0}?s Invalid URL %r: No host suppliedtidnasutf-8sURL has an invalid label.R0t@R.s%s&%s(R<R%RLR'tunicodeR$tlowert startswithR1R RRtargstformatRRR?t UnicodeErrorRFRR!R>(R6R1RstschemeRtthosttportR2R4tfragmentteterrortnetloct enc_params((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR}Fs`" %      $cCs8|r(td|jD|_n t|_dS(s Prepares the given HTTP headers.css'|]\}}t||fVqdS(N(R(RfRGtvalue((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pys sN(RRqRI(R6RI((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR~s"cCsd }d }d }| r=|d k r=d}tj|}ntt|dt|tttt f g}yt |}Wn t t t fk rd }nX|r|}|rtdn|rt||jdt complexjsontdumpstallR=R<R*RNRMtdictRt TypeErrortAttributeErrorRtNotImplementedErrorR)RIR^RFtprepare_content_lengthR](R6RARRR+R]RJtlengtht is_stream((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRs> "    cCst|dryt|dry|j}|jdd|j}ttd|||jd<|j|dnn|dk rt|}|rt||jdRRrtget(R6R]tcurr_postend_postl((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRs     'R0cCs|dkr6t|j}t|r-|nd}n|rt|trlt|dkrlt|}n||}|jj |j|j |j ndS(s"Prepares the given HTTP auth data.iN( R>RR1tanyR<RMRORt__dict__tupdateRR](R6RtR1turl_authtr((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRs ! cCs_t|tjr||_nt||_t|j|}|dk r[||jd` object. Any subsequent calls to ``prepare_cookies`` will have no actual effect, unless the "Cookie" header is removed beforehand.tCookieN(R<R t CookieJarR{RRR>RI(R6Rut cookie_header((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRs   cCs5|p g}x"|D]}|j|||qWdS(sPrepares the given hooks.N(Rl(R6RhRj((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR s  N(R_R`RzRvR>RyRwRR|R}R~RRRRR(((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRxs     M  7   tResponsec BseZdZddddddddd d g Zd Zd Zd ZdZdZdZ dZ e dZ e dZ e dZe dZdedZedddZe dZe dZdZe dZdZdZRS( shThe :class:`Response ` object, which contains a server's response to an HTTP request. t_contentt status_codeRIR1thistorytencodingtreasonRutelapsedtrequestcCstt|jt|_t|_d|_t|_ d|_ d|_ d|_ g|_ d|_ti|_tjd|_d|_dS(Ni(tsuperRRvRnRt_content_consumedR>RRRItrawR1RRRRRutdatetimet timedeltaRR(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRvs         cs0jsjntfdjDS(Nc3s'|]}|t|dfVqdS(N(tgetattrR>(Rftattr(R6(s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pys Us(RtcontentRt __attrs__(R6((R6s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt __getstate__Ns    cCsQx*|jD]\}}t|||q Wt|dtt|dddS(NRR(RqtsetattrR@R>(R6tstateRGR((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt __setstate__YscCs d|jS(Ns(R(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRwascCs|jS(s,Returns true if :attr:`status_code` is 'OK'.(tok(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt__bool__dscCs|jS(s,Returns true if :attr:`status_code` is 'OK'.(R(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt __nonzero__hscCs |jdS(s,Allows you to use a response as an iterator.i(t iter_content(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR:lscCs'y|jWntk r"tSXtS(N(traise_for_statusRRnR@(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRps  cCsd|jko|jtkS(sTrue if this Response is a well-formed HTTP redirect that could have been processed automatically (by :meth:`Session.resolve_redirects`). tlocation(RIRtREDIRECT_STATI(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt is_redirectxscCs(d|jko'|jtjtjfkS(s?True if this Response one of the permanent versions of redirectR(RIRR,tmoved_permanentlytpermanent_redirect(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pytis_permanent_redirectscCstj|jdS(s6The apparent encoding, provided by the chardet libraryR(R(tdetectR(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pytapparent_encodingsicsfd}jr9tjtr9tntj}|}jrc|n|}|rt|}n|S(sIterates over the response data. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. The chunk size is the number of bytes it should read into memory. This is not necessarily the length of each item returned as decoding can take place. If decode_unicode is True, content will be decoded using the best available encoding based on the response. c3stjdry,x%jjdtD] }|Vq.WWqtk r_}t|qtk r}}t|qtk r}t |qXn.x+trjj }|sPn|VqWt_ dS(Ntstreamtdecode_content( R=RRR@R RR RR RR9R(tchunkR(t chunk_sizeR6(s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pytgenerates    (RR<RtboolRRR(R6Rtdecode_unicodeRt reused_chunkst stream_chunkstchunks((RR6s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRs   ccsd}x|jd|d|D]}|dk r>||}n|rV|j|}n |j}|r|dr|r|dd|dkr|j}nd}x|D] }|VqWqW|dk r|VndS(sIterates over the response data, one line at a time. When stream=True is set on the request, this avoids reading the content at once into memory for large responses. .. note:: This method is not reentrant safe. RRiN(R>Rtsplitt splitlinestpop(R6RRt delimitertpendingRtlinestline((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyt iter_liness   .   cCs|jtkry^|jr*tdn|jdkrEd|_n'tj|jt pft|_Wqt k rd|_qXnt |_|jS(s"Content of the response, in bytes.s2The content for this response was already consumediN( RRnRt RuntimeErrorRR>R%R5RtCONTENT_CHUNK_SIZERR@(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRs   +  cCsd}|j}|js"tdS|jdkr=|j}nyt|j|dd}Wn,ttfk rt|jdd}nX|S(sContent of the response, in unicode. If Response.encoding is None, encoding will be guessed using ``chardet``. The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of non-HTTP knowledge to make a better guess at the encoding, you should set ``r.encoding`` appropriately before accessing this property. R0terrorstreplaceN(R>RRR$Rt LookupErrorR(R6RR((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyttexts    cKs|j rtt|jdkrtt|j}|dk rty tj|jj||SWqqtk rmqqXqtntj|j |S(sReturns the json-encoded content of a response, if any. :param \*\*kwargs: Optional arguments that ``json.loads`` takes. iN( RRORRR>RtloadsRLtUnicodeDecodeErrorR(R6tkwargsR((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR+s   cCsj|jjd}i}|rft|}x9|D].}|jdpR|jd}|||d|jko^dknrd|j|j|jf}n|rt|d|ndS( s2Raises stored :class:`HTTPError`, if one occurred.R0iis%s Client Error: %s for url: %siXs%s Server Error: %s for url: %stresponseN(RRR1R(R6thttp_error_msg((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyR@scCs#|js|jjS|jjS(sReleases the connection back to the pool. Once this method has been called the underlying ``raw`` object must not be accessed again. *Note: Should not normally need to be called explicitly.* (RRtcloset release_conn(R6((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRNs  N(R_R`RzRRvRRRwRRR:RaRRRRRnRtITER_CHUNK_SIZER>RRRR+RRR(((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyRs, 0     /&  (MRzRdRtioRRRhRt structuresRRtRRuRRRtpackages.urllib3.fieldsRtpackages.urllib3.filepostR tpackages.urllib3.utilR tpackages.urllib3.exceptionsR R R Rt exceptionsRRRRRRRtutilsRRRRRRRRRRtcompatR R!R"R#R$R%R&R'R(R)R*R+Rt status_codesR,tmovedtfoundtotherttemporary_redirectRRtDEFAULT_REDIRECT_LIMITRRtobjectR-RcRpRxR(((s@/opt/alt/python27/lib/python2.7/site-packages/requests/models.pyts<  "4FL  oE