ó ¦•Dc@s˜ddlZddlZddlZddlZddlZddlZyddlmZWn!ek rddlmZnXy<ddl Z ddl m Z m Z e j e j e j ƒWnek rÏnXddd„ƒYZ e dkr”eejƒdkr dZn ejd Ze ƒZejeƒejƒGHd d d GHddlZejejƒƒejejƒGHejƒd GHejƒndS(iÿÿÿÿN(tStringIO(tSIGPIPEtSIG_IGNtCurlcBs¤eZdZdgd„Zd„Zd„Zd„Zd„Zdd„Z ddd„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„ZRS(s)High-level interface to pycurl functions.tcstjƒˆ_ˆj|ƒdˆ_|ˆ_dˆ_dˆ_ˆjtj dƒˆjtj dƒˆjtj dƒˆjtj dƒˆjtj dƒˆjdƒˆjtjdƒ‡fd†}ˆjtj|ƒ‡fd †}ˆjtj|ƒdS( NiRiiis /dev/nullicsˆj|7_dS(N(tpayload(tx(tself(s3/usr/lib64/python2.7/site-packages/curl/__init__.pytpayload_callback0scsˆj|7_dS(N(thdr(R(R(s3/usr/lib64/python2.7/site-packages/curl/__init__.pytheader_callback3s(tpycurlRthandletset_urlt verbosityt fakeheadersRthrdt set_optiontSSL_VERIFYHOSTtFOLLOWLOCATIONt MAXREDIRStNOSIGNALt COOKIEFILEt set_timeouttNETRCt WRITEFUNCTIONtHEADERFUNCTION(Rtbase_urlRRR ((Rs3/usr/lib64/python2.7/site-packages/curl/__init__.pyt__init__s"      cCs|jtj|ƒdS(s&Set timeout for a retrieving an objectN(RR tTIMEOUT(Rttimeout((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyR7scCs#||_|jtj|jƒdS(s!Set the base URL to be retrieved.N(RRR tURL(Rturl((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyR ;s cGst|jj|ƒdS(sSet an option on the retrieval.N(tapplyR tsetopt(Rtargs((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyR@scCs|jtj|ƒdS(s'Set verbosity to 1 to see transactions.N(RR tVERBOSE(Rtlevel((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyt set_verbosityDscCsv|jr"|jtj|jƒn|rP|jtjtjj|j|ƒƒnd|_ d|_ |j j ƒ|j S(sPerform the pending request.R( RRR t HTTPHEADERRtostpathtjoinRRR R tperform(Rt relative_url((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyt __requestHs (   cCs@|r |dtj|ƒ7}n|jtjdƒ|j|ƒS(s=Ship a GET request for a specified URL, capture the response.t?i(turllibt urlencodeRR tHTTPGETt_Curl__request(RR tparams((s3/usr/lib64/python2.7/site-packages/curl/__init__.pytgetSscCs<|jtjdƒ|jtjtj|ƒƒ|j|ƒS(s=Ship a POST request to a specified CGI, capture the response.i(RR tPOSTt POSTFIELDSR/R0R2(RtcgiR3((s3/usr/lib64/python2.7/site-packages/curl/__init__.pytpostZscCs|jS(s'Return the body from the last response.(R(R((s3/usr/lib64/python2.7/site-packages/curl/__init__.pytbody`scCs|jS(s)Return the header from the last response.(R (R((s3/usr/lib64/python2.7/site-packages/curl/__init__.pytheaderdscGst|jj|ƒS(s Get information about retrieval.(R!R tgetinfo(RR#((s3/usr/lib64/python2.7/site-packages/curl/__init__.pytget_infohscCs*i}|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtj ƒ|d<|jjtj ƒ|d<|jjtj ƒ|d <|jjtj ƒ|d <|jjtj ƒ|d <|jjtjƒ|d <|jjtjƒ|d <|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtj ƒ|d<|jjtj ƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtjƒ|d<|jjtj ƒ|d<|S(s7Return a dictionary with all info on the last response.s effective-urls http-codes total-timesnamelookup-times connect-timespretransfer-times redirect-timesredirect-counts size-uploads size-downloads speed-uploads header-sizes request-sizescontent-length-downloadscontent-length-uploads content-types response-codesspeed-downloadsssl-verifyresulttfiletimesstarttransfer-timeshttp-connectcodeshttpauth-availsproxyauth-availsos-errnos num-connectss ssl-enginest cookielistt lastsocketsftp-entry-path(!R R;R t EFFECTIVE_URLt HTTP_CODEt TOTAL_TIMEtNAMELOOKUP_TIMEt CONNECT_TIMEtPRETRANSFER_TIMEt REDIRECT_TIMEtREDIRECT_COUNTt SIZE_UPLOADt SIZE_DOWNLOADt SPEED_UPLOADt HEADER_SIZEt REQUEST_SIZEtCONTENT_LENGTH_DOWNLOADtCONTENT_LENGTH_UPLOADt CONTENT_TYPEt RESPONSE_CODEtSPEED_DOWNLOADtSSL_VERIFYRESULTt INFO_FILETIMEtSTARTTRANSFER_TIMEtHTTP_CONNECTCODEtHTTPAUTH_AVAILtPROXYAUTH_AVAILtOS_ERRNOt NUM_CONNECTSt SSL_ENGINEStINFO_COOKIELISTt LASTSOCKETtFTP_ENTRY_PATH(Rtm((s3/usr/lib64/python2.7/site-packages/curl/__init__.pytinfolsDcCs|jj|ƒdkS(s3Did a given check string occur in the last payload?i(Rtfind(Rtcheck((s3/usr/lib64/python2.7/site-packages/curl/__init__.pytanswered‘scCs8|jr|jjƒnd|_d|_d|_dS(s#Close a session, freeing resources.RN(R tclosetNoneR R(R((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyRc•s    cCs|jƒdS(N(Rc(R((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyt__del__œsN(t__name__t __module__t__doc__RRR RR&RdR2R4R8R9R:R<R_RbRcRe(((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyRs           %  t__main__ishttp://curl.haxx.seit=iJs sos-errno((R(tsysR/t exceptionst mimetoolsR t cStringIORt ImportErrortsignalRRRRftlentargvR tcR4R9tpprintR_R<RXRc(((s3/usr/lib64/python2.7/site-packages/curl/__init__.pyt s0H   ‰