简体   繁体   中英

using several xmlrpc commands on twisted

I have a simple client code using xmlrpclib.

try:
       Server.func1
       Server.func2
       .....
       Server.funcN
except:
    pass
, where Server - ServerProxy from xmlrpclib. How to do this on twisted ? I see this example:

\nfrom twisted.web.xmlrpc import Proxy \nfrom twisted.internet import reactor \n\ndef printValue(value): \n    print repr(value) \n    reactor.stop() \n\ndef printError(error): \n    print 'error', error \n    reactor.stop() \n\nServer = Proxy('http://advogato.org/XMLRPC') \nServer.callRemote('func1',).addCallbacks(printValue, printError) \nreactor.run() \n

but how to add several nesting callRemote functions ?

You have code in the sample you pasted which takes an action when an XML-RPC call completes. printValue prints the result of a call and printError print an error which occurs during a call.

If you want to make another call after one finishes, then maybe instead of just printing something in printValue , you could issue another Server.callRemote there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM