m -Ec@s3dZddd!ZdkZdkZdkZdkZdklZdkl Z dk l Z dk l Z d k l Z d klZlZd klZlZlZlZd klZlZd klZdefdYZdfdYZdfdYZdddZei dei!Z"eddZ#dZ$dZ%dZ&de'ge'fdZ(dZ)he'de$<e'de%<e'd e&<e'ge(<e'fe)<d:e?<d;e@<d<e0<d=eA<d>eBRRRARBtct MultiParttrenderR?tsockettAF_INETt SOCK_STREAMtsocktconnectRRRJtmakefiletreplyRtreadlinetlinetsplittverRLRMRRRtstript mimetoolstMessageR#RORT(R R)R`RMRLRaRqRbRjRmRoRdR_R-RcR R;R1RO((RR5sR       (     ( RRRRRRRR RURTR:R5(((RR2s I tObjectcBsJtZdZeZeZeZeZdZeeeedZ dZ RS(s)Surrogate object for an object on the webR&R"R!cKs||_||_|id o)|id ot|d|dtmarshal_whateverRcttnameR?(RcRYRRRRR;R1((Rt marshal_list%s  $cCst||dS(Nttuple(RRcRY(RcRY((Rt marshal_tuple/sf1.0ilcCsSytt|||}Wn/tj o#d|tt|f}nX|S(Ns%s=%s(R8R:R1R-R<tKeyErrorR=R@(R-R1R<((RR:s !cCsNg}x*|D]"\}}|it||q W|odi|pdS(NR$R%(R*R0R-R1R>RR?(R0R-R1R*((Rtquerify?s  s bci.NotFoundsbci.InternalErrorsbci.BadRequestsbci.Unauthorizedsbci.ServerErrorsbci.NotAvailabletAttributeErrort BadRequesttEOFErrortIOErrort ImportErrorR/t InternalErrorRt MemoryErrort NameErrorRPR[t OverflowErrort RuntimeErrorR\t SyntaxErrort SystemErrort SystemExitR.t UnauthorizedRtZeroDivisionErrorRQc Bs5tZdddddddddd ZdZRS(Nc CsU||_||_||_||_||_ ||_ ||_ ||_ | |_dS(sWContains information about an exception which occurs in a remote method callN(tetypeR texc_typetevaluet exc_valuetefiletexc_filetelinetexc_lineRR*t http_codethttp_msgt http_messaget http_respRO( R RRRRRR*RRR((RR fs        cCs,d|i|i|i|i|i|ifS(Ns#%s (File: %s Line: %s) %s %s for %s(R RRRRRR(R ((Rt__repr__ts(RRRR R(((RRQds$RecBstZdZdZdZhdd<dd<dd<d d<d d<d d<d d <dd<dd<ddRetListTypet TupleTypetFileTypeR7RBtfnR tlowertext_extmapR tctt_encmaptceR#RYR@t_headerst_datat _boundaryt_top(R RRRRRRRR_RdRRvRDRYRcR;R1((RR |sd    <           cCs*dtttttdfS(Ns%s_%s_%siʚ;(Rttimetgetpidtrandom(R ((RRsc Cs|i}g}|ioSx|iD]\}}|doo|id||dfx@|i D]2} | djo|id| || fqeqeW|idq&q&Wg}g}|i }x$|iD]}|i|iqW|id||id|i||id|di|}|id t||i|di|SnFx|iD]\}}|doo|id||dfx@|i D]2} | djo|id| || fqqW|idqyqyW|id|i og}|i }x$|iD]}|i|iq3W|id||id|i||id|di|Sndi||iSdS( NRs%s: %ss; %s=%ss s--%s s --%s s --%s-- R%sContent-Length: %s (R RRDtsRR0RcR1R>tkeysR-tpR;RRRR_RfR?R(( R RR_RDRcRRR;R1R-((RRfs\      #       #    R%s text/plaintrdbthtmls text/htmltdtmlthtmtdtmtgifs image/giftjpgs image/jpegtexesapplication/octet-streamtbinarys image/jpg(RRR RRfRRR(((RRe{s  <  ,` cCsL|djo|djotSn|djo|djotSnd|S(NiiiXs HTTP_Error_%s(tcodeR[R\(R((Rt ErrorTypess s! Usage: %s [-u username:password] url [name=value ...] where url is the web resource to call. The -u option may be used to provide a user name and password. Optional arguments may be provides as name=value pairs. In a name value pair, if a name ends in ":file", then the value is treated as a file name and the file is send using the file-upload protocol. If the file name is "-", then data are taken from standard input. The body of the response is written to standard output. The headers of the response are written to standard error. icCsdk}d}y|itidd\}}|d} td|}|o!|ddi d\}}nh} xy|dD]m}|i d\}} |ddjo7|d }| d jo ti} qt| d } n| | |sR]t=is:fileR}R^R%cCsd|S(Ns%s: %s (RD(RD((RR/ss ( tgetoptRtuserRRtargvtoptlistRRtfiltertuRptpwR)targRvR1tstdintopentusagetexitRRXRRRzR tbodytstderrtwriteR?tmapR0(RRRRRRRRRvRXRR R)R1((Rtmains6  !    /t__main__(KRyt __version__RRtreRgRsthttplibRCtosRRRtbase64RAturllibturlopenR=ttypesRRRRtstringR2t maketransR t ExceptionRRRuRR{tcompiletIRR3R~RRR:RRR8RRR[RRRR\RPRRRRR/RRRRRRRRR.RRRZRQReRRRRR(-RsRCRRRRZRRRR~RR\RuRRR{RRR2RRRR8RRR=RRRRPR3RRRQRRARR[RRgR RRRRRe((Rt?sP $      '    Q    "