在 Twisted 上使用多个 xmlrpc 命令
我有一个使用 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()
但如何添加多个嵌套的callRemote函数呢?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您粘贴的示例中有代码,该代码在 XML-RPC 调用完成时执行操作。
printValue
打印调用结果,printError
打印调用期间发生的错误。如果您想在一次调用完成后进行另一次调用,那么您可以在那里发出另一个
Server.callRemote
,而不是仅仅在printValue
中打印一些内容。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 andprintError
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 anotherServer.callRemote
there.