m %UIc@sSdZdkZdkZdkZdkZdkTyeWnej o dZnXye i i djZ Wnej o dZ nXei didZeidZeo dZn d Zd Zd d d Zd d  ZdZdZdZdZdZdZdZdZdZdZdZ dZ!de"fdYZ#de#fdYZ$de#fdYZ%de#fdYZ&e oe'Z(Z)e*e Z*Z n?d fd!YZ)e)d e)dZ*Z e e*fd"Z(d#fd$YZ+d%Z,dk-Z-y dk.Z/Wne0j odk/Z/nXd&fd'YZ1d(Z2e+e1fZ3e pe3e)fZ3nydk4Z4e4i5Z6e4i7Z8Wn#e9e0fj odZ6Z8nXydk4Z4e4i:Z;Wne9e0fj o dZ;nXy'dk<Z<e=e<d)p e0nWne0j o dZ>nXd*fd+YZ>y+d,k?l@Z@e=e@d-p e0nWne0j o dZAnXd.fd/YZAd0fd1YZBd2fd3YZ:d4fd5YZ7d6fd7YZCd8fd9YZDd:fd;YZEd<ZFddddd=ZGd>ZHd?fd@YZIdAfdBYZJdCeJfdDYZKdEfdFYZLeLZMe dGjoeLdHZNeNGHyeNiOiPGHWne#j oZQdIGeQGHnXeEeNZReRiOiPeRiOiPyxeRD] ZSeSGHqWWqOe#j oZQdIGeQGHqOXndS(Js~ An XML-RPC client interface for Python. The marshalling and response parser code can also be used to implement XML-RPC servers. Exported exceptions: Error Base class for client errors ProtocolError Indicates an HTTP protocol error ResponseError Indicates a broken response package Fault Indicates an XML-RPC fault package Exported classes: ServerProxy Represents a logical connection to an XML-RPC server MultiCall Executor of boxcared xmlrpc requests Boolean boolean wrapper to generate a "boolean" XML-RPC value DateTime dateTime wrapper for an ISO 8601 string or time tuple or localtime integer value to generate a "dateTime.iso8601" XML-RPC value Binary binary data wrapper SlowParser Slow but safe standard parser (based on xmllib) Marshaller Generate an XML-RPC params chunk from a Python data structure Unmarshaller Unmarshal an XML-RPC response from incoming XML event message Transport Handles an HTTP transaction to an XML-RPC server SafeTransport Handles an HTTPS transaction to an XML-RPC server Exported constants: True False Exported functions: boolean Convert any Python value to an XML-RPC boolean getparser Create instance of the fastest available parser & attach to an unmarshalling object dumps Convert an argument tuple or a Fault instance to an XML-RPC request (or response, if the methodresponse option is used). loads Convert an XML-RPC packet to unmarshalled data plus a method name (None if not present). N(t*tboolis[-]cCs2to'|o ||ot||}n|S(N(tunicodetencodingtis8bittdata(RRR((t&/data/zmath/lib/python2.4/xmlrpclib.pyt_decodescCs4||dd}||dd}||ddS(Nt&s&ts>(treplacets(R R ((RtescapescCs/y|idSWntj o |SnXdS(Ntascii(tstringtencodet UnicodeError(R((Rt _stringifyscCs|S(N(R(R((RRss1.0.1liiiDii ipiԁiCiBiiitErrorcBstZdZdZRS(sBase class for client errors.cCs t|S(N(treprtself(R((Rt__str__s(t__name__t __module__t__doc__R(((RRs t ProtocolErrorcBs tZdZdZdZRS(s!Indicates an HTTP protocol error.cCs5ti|||_||_||_||_dS(N(Rt__init__Rturlterrcodeterrmsgtheaders(RRRRR((RRs     cCsd|i|i|ifS(Ns(RRRR(R((Rt__repr__s(RRRRR (((RRs  t ResponseErrorcBstZdZRS(s$Indicates a broken response package.(RRR(((RR!s tFaultcBs tZdZdZdZRS(s#Indicates an XML-RPC fault package.cKs#ti|||_||_dS(N(RRRt faultCodet faultString(RR#R$textra((RRs  cCsd|it|ifS(Ns(RR#RR$(R((RR s(RRRRR (((RR"s  tBooleancBsGtZdZddZdZdZdZdZdZRS(saBoolean-value wrapper. Use True or False to generate a "boolean" XML-RPC value. icCsti||_dS(N(toperatorttruthtvalueR(RR)((RR#scCs|id|idS(Ns%%d (touttwriteRR)(RR*((RR&scCs-t|to |i}nt|i|S(N(t isinstancetotherR&R)tcmpR(RR-((Rt__cmp__)s cCs.|iodt|Sndt|SdS(Nss(RR)tid(R((RR .s cCs|iS(N(RR)(R((Rt__int__4scCs|iS(N(RR)(R((Rt __nonzero__7s( RRRRRR/R R1R2(((RR&s      cCs|ti|S(s.Convert any Python value to XML-RPC 'boolean'.N(t _truefalseR'R(R)(R)R3((RtbooleanGstDateTimecBsGtZdZddZdZdZdZdZdZRS(sDateTime wrapper for an ISO 8601 string or time tuple or localtime integer value to generate 'dateTime.iso8601' XML-RPC value. icCs|t|tp_t|ttifp0|djoti}nti|}ntid|}n||_dS(Nis%Y%m%dT%H:%M:%S( R,R)t StringTypet TupleTypettimet struct_timet localtimetstrftimeR(RR)((RR^s cCs-t|to |i}nt|i|S(N(R,R-R5R)R.R(RR-((RR/gs cCs|iS(N(RR)(R((RRqscCsdt|it|fS(Ns(RRR)R0(R((RR tscCsti||_dS(N(RtstripRRR)(RR((RtdecodewscCs.|id|i|i|iddS(Nss (R*R+RR)(RR*((RRzs ( RRRRR/RR R=R(((RR5Xs    cCst}|i||S(N(R5R)R=R(RR)((Rt _datetimes  tBinarycBs>tZdZedZdZdZdZdZRS(sWrapper for binary data.cCs ||_dS(N(RR(RR((RRscCs|ipdS(Nt(RR(R((RRscCs-t|to |i}nt|i|S(N(R,R-R?RR.R(RR-((RR/s cCsti||_dS(N(tbase64t decodestringRR(RR((RR=scCs:|idtiti|i||iddS(Ns s (R*R+RARtStringIORR(RR*((RRs ( RRRtNoneRRR/R=R(((RR?s     cCst}|i||S(N(R?R)R=R(RR)((Rt_binarys  t XMLParsert SgmlopParsercBs,tZdZdZdZdZRS(NcCs|i|_|i|_|i|_|i|_ t i |_ |i i ||i i|_hdd<dd<dd<dd<d d <|_dS( NtampRtgtR tltR tapost'tquott"(ttargettstartRtfinish_starttagtendt finish_endtagRt handle_datatxmlt handle_xmltsgmlopRFtparsertregistertfeedtentity(RRO((RRs    cCs)z|iiWdd|_|_XdS(N(RRXtcloseRDRZ(R((RR\scCs:tid|}|o|i|iddndS(Nsencoding\s*=\s*['"]([^"']+)["']i(tretsearchtattrtmRRVtgroup(RttagR_R`((Rt handle_procscCsCy|i|i|Wn$tj o|id|nXdS(Ns&%s;(RRTR[tKeyError(RR[((Rthandle_entityrefs(RRRR\RcRe(((RRGs   (sexpatt ParserCreatet ExpatParsercBs#tZdZdZdZRS(NcCsttidd|_}||_|i|_ |i |_ |i |_ d}|ip d}n|i|ddS(Nsutf-8(texpatRfRDRt_parserRXROt_targetRPtStartElementHandlerRRtEndElementHandlerRtCharacterDataHandlerRtreturns_unicodeRU(RRORRX((RRs      cCs|ii|ddS(Ni(RRitParseR(RR((RRZscCs#|iidd|`|`dS(NR@i(RRiRoRj(R((RR\s(RRRRZR\(((RRgs t SlowParsercBstZdZdZRS(s/Default XML parser (based on xmllib.XMLParser).cCsdk}|itijo|ift_n|i|_|i|_ |i |_ |i |_ |i |_y|ii|ddWn#tj o|ii|nXdS(Nt accept_utf8i(txmllibRFRpt __bases__RORURRVRPtunknown_starttagRRTt handle_cdataRRtunknown_endtagRt TypeError(RRORr((RRs      (RRRR(((RRps t MarshallercBstZdZeddZhZdZdZdZeee s   cCsg}|i}|i}t|to=|d|hd|i <d|i <||dnG|dx/|D]'}|d||||dqvW|dt i |d }|S( Ns R#R$s s s s s R@(R*tappendR+Rt_Marshaller__dumptdumpR,tvaluesR"R#R$tvRtjointresult(RR~R}R+RRR*((RtdumpsFs"       cCsTy|it|}Wn&tj otdt|nX||||dS(Nscannot marshal %s objects(RtdispatchttypeR)tfRdRwR+(RR)R+R((Rt__dumpas cCs%|ip tdn|ddS(Ns0cannot marshal None unless allow_none is enableds(RRzRwR+(RR)R+((Rtdump_nilis  cCsO|tjp |tjo tdn|d|t||ddS(Nsint exceeds XML-RPC limitss s (R)tMAXINTtMININTt OverflowErrorR+tstr(RR)R+((Rtdump_intos   cCs0|d||odpd|ddS(Nst1t0s (R+R)(RR)R+((Rt dump_boolys cCsU|tjp |tjo tdn|d|tt||ddS(Nslong int exceeds XML-RPC limitss s (R)RRRR+Rtint(RR)R+((Rt dump_longs   cCs(|d|t||ddS(Nss (R+RR)(RR)R+((Rt dump_doubles cCs(|d||||ddS(Nss (R+R R)(RR)R+R ((Rt dump_strings cCs:|i|i}|d||||ddS(Nss (R)RRRR+R (RR)R+R ((Rt dump_unicodes cCst|}|ii|o tdnd|i|<|i}|dx|D]}|||qSW|d|i|=dS(Ns"cannot marshal recursive sequencess s ( R0R)tiRRythas_keyRwRDR|R}R+R(RR)R+R}RR((Rt dump_arrays      cCst|}|ii|o tdnd|i|<|i}|dx|i D]\}}|dt|tj o=to)t|tjo|i|i}qtdn|d||||||dqYW|d|i|=dS(Ns%cannot marshal recursive dictionariess s sdictionary key must be strings%s s s (R0R)RRRyRRwRDR|R}R+titemstkRRR6Rt UnicodeTypeRRR (RR)R+R R}RRR((Rt dump_structs$          cCsG|itjo ||_|i||`n|i|i|dS(N(R)t __class__tWRAPPERSR+RRRt__dict__(RR)R+((Rt dump_instances    ( RRRRDRRRR|RtNoneTypeRtIntTypet_bool_is_builtinRRRtLongTypeRt FloatTypeR RR6RRRRR7tListTypeRtDictTypeRt InstanceType(((RRx1s8                    t UnmarshallercBsmtZdZdZdZdZdZdZdZe i dZ dZ hZ d Zee d a object used to boxcar method calls server should be a ServerProxy object. Methods can be added to the MultiCall using normal method call syntax e.g.: multicall = MultiCall(server_proxy) multicall.add(2,3) multicall.get_address("Guido") To execute the multicall, call the MultiCall object e.g.: add_result, address = multicall() cCs||_g|_dS(N(tserverRt_MultiCall__servert_MultiCall__call_list(RR((RRs cCsdt|S(Ns(R0R(R((RR scCst|i|S(N(RRRR(RR((RRscCsXg}x6|iD]+\}}|ihd|<d|<qWt|iii |S(NRR( tmarshalled_listRRRRR{RRtsystemt multicall(RRRR((RRs  #(RRRRR RRR(((RRs    cCsto/to(tttttt}t|}n[t }tot|}n;t ot |}n$t ot |}n t |}||fS(sgetparser() -> parser, unmarshaller Create an instance of the fastest available parser, and attach it to an unmarshalling object. Return both objects. N( t FastParsertFastUnmarshallerRRRER>R"RORXRRGRgRp(RORX((Rt getparsers  cCst|to d}n|ot|ton|p d}ntot|}nt||}|i |}|djodt |}nd}|o?t|tp|i|}n|d|d|df}n"|o|d|d f}n|Sti|d S( sdata [,options] -> marshalled data Convert an argument tuple or a Fault instance to an XML-RPC request (or response, if the methodresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet. If this option is used with a tuple, the tuple must be a singleton (i.e. it can contain only one element). encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, where necessary. isutf-8s$ s s s s s s R@N(R,RR"tmethodresponseR7RtFastMarshallerR`RxRzRRRt xmlheadert methodnameR6RRR(RRRRRzR`RR((RRs.   cCs<t\}}|i||i|i|ifS(sdata -> unmarshalled data, method name Convert an XML-RPC packet to unmarshalled data plus a method name (None if not present). If the XML-RPC packet represents a fault condition, this function raises a Fault exception. N(RtptuRZRR\R(RRR((Rtloads-s   t_MethodcBs#tZdZdZdZRS(NcCs||_||_dS(N(tsendRt _Method__sendRt _Method__name(RRR((RRBs cCst|id|i|fS(Ns%s.%s(RRRRR(RR((RREscGs|i|i|S(N(RRRR(RR((RRGs(RRRRR(((RR?s  t TransportcBsutZdZdeZddZdZdZdZdZ dZ d Z d Z d Z d ZRS( s1Handles an HTTP transaction to an XML-RPC server.s'xmlrpclib.py/%s (by www.pythonware.com)ic Cs|i|}|o|idn|i||||i |||i ||i |||i \}} }|djot|||| |n||_y|ii}Wntj o d}nX|i|i|S(Nii(Rtmake_connectionthostthtverbosetset_debuglevelt send_requestthandlert request_bodyt send_hosttsend_user_agentt send_contenttgetreplyRRRRt_conntsocktAttributeErrorRDt_parse_responsetgetfile( RRRRRRRRRR((Rtrequest_s$      cCstS(N(R(R((RRscCsh}t|to|\}}ndk}|i|\}}|oSdk}|i|i |}t i t i |d}dd|fg}nd}|||fS(NR@t AuthorizationsBasic (tx509R,RR7turllibt splitusertauthRAt encodestringtunquoteRRtsplitt extra_headersRD(RRRR RAR R ((Rt get_host_infos  cCs.dk}|i|\}}}|i|S(N(thttplibRRRRR tHTTP(RRR RR((RRs cCs|id|dS(NtPOST(t connectiont putrequestR(RRRR((RRscCs~|i|\}}}|id||oKt|to|i }nx(|D]\}}|i||qVWndS(NtHost( RRRRR Rt putheaderR,RRtkeyR)(RRRRR R)R((RRs cCs|id|idS(Ns User-Agent(RRRt user_agent(RR((RRscCsR|idd|idtt||i|o|i|ndS(Ns Content-Typestext/xmlsContent-Length(RRRRRt endheadersR(RRR((RRs  cCs|i|dS(N(RRtfileRD(RR((Rtparse_responsescCs|i\}}xd|o|id}n|id}|pPn|i odGt |GHn|i |qW|i |i |i S(Niisbody:( RRRRRtrecvtresponseRtreadRRRZR\(RRRRRR((RRs   (RRRt __version__RRRRRRRRRRR(((RRPs  #    t SafeTransportcBstZdZdZRS(s2Handles an HTTPS transaction to an XML-RPC server.cCskdk}|i|\}}}y |i}Wntj otdnX||d|phSdS(Ns-your version of httplib doesn't support HTTPS( RRRRRR tHTTPSRtNotImplementedErrorRD(RRRRR R#((RRs  (RRRR(((RR" s t ServerProxycBsDtZdZeedddZdZdZeZdZRS(suri [,options] -> a logical connection to an XML-RPC server uri is the connection point on the server, given as scheme://host/target. The standard implementation always supports the "http" scheme. If SSL socket support is available (Python 2.0), it also supports "https". If the target part and the slash preceding it are both omitted, "/RPC2" is assumed. The following options can be given as keyword arguments: transport: a transport factory encoding: the request encoding (default is UTF-8) All 8-bit strings passed to the server proxy are assumed to use the given encoding. icCsdk}|i|\}}|djo tdn|i|\|_|_|ip d|_n|djo'|djo t }qt }n||_ ||_||_||_dS(Nthttpthttpssunsupported XML-RPC protocols/RPC2(R&R'(R t splittypeturiRtIOErrort splithostRt_ServerProxy__hostt_ServerProxy__handlert transportRDR"Rt_ServerProxy__transportRt_ServerProxy__encodingRt_ServerProxy__verboseRzt_ServerProxy__allow_none(RR)R.RRRzR R((RREs            cCsmt||d|id|i}|ii|i|i |d|i }t |djo|d}n|S(NRRzRii( RRRRR0R2RR/R,R-R1RR(RRRRR((Rt __request]scCsd|i|ifS(Ns(RR,R-(R((RR oscCst|i|S(N(RRt_ServerProxy__requestR(RR((RRws( RRRRDRR4R RR(((RR%/s   t__main__shttp://time.xmlrpc.com/RPC2tERROR(TRR]RR8R'ttypesRt NameErrorRDRRRRtcompileR^RR R RR!RRt PARSE_ERRORt SERVER_ERRORtAPPLICATION_ERRORt SYSTEM_ERRORtTRANSPORT_ERRORtNOT_WELLFORMED_ERRORtUNSUPPORTED_ENCODINGtINVALID_ENCODING_CHARtINVALID_XMLRPCtMETHOD_NOT_FOUNDtINVALID_METHOD_PARAMStINTERNAL_ERRORt ExceptionRRR!R"RR4R&RR5R>RAt cStringIORCt ImportErrorR?RERt _xmlrpclibtParserRRRRRxRRWthasattrRGt xml.parsersRhRgRpRRRRRRRRR"R%tServerRt currentTimetgetCurrentTimeRtmultiR(AR?R;RARIRAR!RRhR5RR>RR4RR R'R:RR%R?RRpRRDRR@RRGR]RRBR!RRWRRRRCRR=R"RR8RMRRRgRR<RERERRPR"RRCRRRRxR&RR>RR((Rt?s$        '            $   - "O $Q