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-0.6.tar.gz
(6.0 kB
view details)
Built Distributions
File details
Details for the file tornado-xmlrpc-0.6.tar.gz
.
File metadata
- Download URL: tornado-xmlrpc-0.6.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d6df3ce7def541afc6c56e6f63fc1a1dc23883b7ddfb799cf1390ffcdce1351 |
|
MD5 | cae7aa201954c2316a616d7da7718607 |
|
BLAKE2b-256 | a7fd044a78d7201779365e25f71e5a5901555403de6f7bf29e67052f25e9b493 |
File details
Details for the file tornado_xmlrpc-0.6-py3-none-any.whl
.
File metadata
- Download URL: tornado_xmlrpc-0.6-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6788c3caf1710bd0c0c531a3b3ab595cd8e5d90f124275cc5957f160e94caea |
|
MD5 | d9deb17dbc3f0ad001493ea0ed205eca |
|
BLAKE2b-256 | dd41e2d0a475a8b610ed663b61d58b2c71e09b6f95639f51d09b1241d3f3fb63 |
File details
Details for the file tornado_xmlrpc-0.6-py2-none-any.whl
.
File metadata
- Download URL: tornado_xmlrpc-0.6-py2-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cad65e0d5098dcbd3a8486e8f838a73f105edc8057a29c57b1f2634fef14719 |
|
MD5 | 40a57caf3a1ac19e036884f1b9b456aa |
|
BLAKE2b-256 | 9998d3c0fb522f4e0d588405825685ecb661d72d95a6f9a2b9014a15680a6ef1 |