Test
Test

Reputation: 11

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:

from twisted.web.xmlrpc import Proxy
from twisted.internet import reactor

def printValue(value):
    print repr(value)
    reactor.stop()

def printError(error):
    print 'error', error
    reactor.stop()

Server = Proxy('http://advogato.org/XMLRPC')
Server.callRemote('func1',).addCallbacks(printValue, printError)
reactor.run()

but how to add several nesting callRemote functions ?

Upvotes: 1

Views: 325

Answers (1)

Jean-Paul Calderone
Jean-Paul Calderone

Reputation: 48335

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.

Upvotes: 1

Related Questions