Skip to main content

Tornado XML-RPC server and client

Project description

Tornado XMLRPC

.. image::

.. image::
:alt: Latest Version

.. image::

.. image::

.. image::

XML-RPC server and client implementation based on tornado. Using lxml and AsyncHttpClient.


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),

def test_00_test(self):
result = yield self.server.test()

def test_10_args(self):
result = yield self.server.args(1, 2, 3, 4, 5)
self.assertEqual(result, 5)

def test_20_kwargs(self):
result = yield self.server.kwargs(foo=1, bar=2)
self.assertEqual(result, 2)

def test_20_kwargs(self):
result = yield self.server.args_kwargs(1, 2, 3, 4, 5, foo=1, bar=2)
self.assertEqual(result, 7)

def test_30_exception(self):
yield self.server.exception()
except client.RemoteServerException as e:
self.assertIn("YEEEEEE!!!", e.message)
raise RuntimeError("No exception")

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tornado-xmlrpc, version 0.5
Filename, size File type Python version Upload date Hashes
Filename, size tornado_xmlrpc-0.5-py2-none-any.whl (8.3 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size tornado-xmlrpc-0.5.tar.gz (5.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page