开发者

using several xmlrpc commands on twisted

I have a simple clie开发者_运维百科nt 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 ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜