Tornado XML-RPC server and client
Project description
XML-RPC server and client implementation based on tornado. Using lxml and AsyncHttpClient.
Example:
from tornado_xmlrpc import handler, client
from tornado.testing import *
class XMLRPCTestHandler(handler.XMLRPCHandler):
def rpc_test(self):
return None
def rpc_args(self, *args):
return len(args)
def rpc_kwargs(self, **kwargs):
return len(kwargs)
def rpc_args_kwargs(self, *args, **kwargs):
return len(args) + len(kwargs)
def rpc_exception(self):
raise Exception("YEEEEEE!!!")
class TestSimple(tornado.testing.AsyncHTTPTestCase):
def setUp(self):
super(TestSimple, self).setUp()
self.server = client.ServerProxy("http://localhost:%d" % self.get_http_port())
def tearDown(self):
super(TestSimple, self).tearDown()
self.server = None
def get_app(self):
return Application(handlers=[
('/', XMLRPCTestHandler),
])
@gen_test
def test_00_test(self):
result = yield self.server.test()
self.assertIsNone(result)
@gen_test
def test_10_args(self):
result = yield self.server.args(1, 2, 3, 4, 5)
self.assertEqual(result, 5)
@gen_test
def test_20_kwargs(self):
result = yield self.server.kwargs(foo=1, bar=2)
self.assertEqual(result, 2)
@gen_test
def test_20_kwargs(self):
result = yield self.server.args_kwargs(1, 2, 3, 4, 5, foo=1, bar=2)
self.assertEqual(result, 7)
@gen_test
def test_30_exception(self):
try:
yield self.server.exception()
except client.RemoteServerException as e:
self.assertIn("YEEEEEE!!!", e.message)
else:
raise RuntimeError("No exception")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tornado-xmlrpc-1.2.tar.gz
(6.1 kB
view details)
Built Distribution
File details
Details for the file tornado-xmlrpc-1.2.tar.gz
.
File metadata
- Download URL: tornado-xmlrpc-1.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a17a6b885c8f07c74121b2aed492d30cc5cca8800593ee075c84c8e818dc9fd4 |
|
MD5 | 5ec2af32e8abdb13adcc0881e5d2e5e5 |
|
BLAKE2b-256 | 4a447b32006dbf8bbaae24e3e50df059620274a839b630841757ca50c03b51a9 |
File details
Details for the file tornado-xmlrpc-1.2.macosx-10.11-x86_64.tar.gz
.
File metadata
- Download URL: tornado-xmlrpc-1.2.macosx-10.11-x86_64.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a37810c15c4b247ee657463ff7df39feec507099d1026b19083bff3af3d56bd2 |
|
MD5 | 5238dc1520bf6e27d9db518e77bec7b5 |
|
BLAKE2b-256 | b27508a59f70e419e5ad4ed1a66420af647ef07bf64205c4528553531bd76d4c |