diff options
Diffstat (limited to 'vendor/Twisted-10.0.0/doc/web/examples/xmlrpcclient.py')
-rw-r--r-- | vendor/Twisted-10.0.0/doc/web/examples/xmlrpcclient.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/Twisted-10.0.0/doc/web/examples/xmlrpcclient.py b/vendor/Twisted-10.0.0/doc/web/examples/xmlrpcclient.py new file mode 100644 index 0000000000..49c29b1fea --- /dev/null +++ b/vendor/Twisted-10.0.0/doc/web/examples/xmlrpcclient.py @@ -0,0 +1,23 @@ +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() + +proxy = Proxy('http://advogato.org/XMLRPC') +proxy.callRemote('test.sumprod', 3, 5).addCallbacks(printValue, printError) +reactor.run() +proxy.callRemote('test.capitalize', 'moshe zadka').addCallbacks(printValue, + printError) +reactor.run() +proxy = Proxy('http://time.xmlrpc.com/RPC2') +proxy.callRemote('currentTime.getCurrentTime').addCallbacks(printValue, printError) +reactor.run() +proxy = Proxy('http://betty.userland.com/RPC2') +proxy.callRemote('examples.getStateName', 41).addCallbacks(printValue, printError) +reactor.run() |