Tornado XML-RPC server and client
Project description
Tornado XMLRPC
==============
.. image:: https://travis-ci.org/mosquito/tornado-xmlrpc.svg
:target: https://travis-ci.org/mosquito/tornado-xmlrpc
.. image:: https://img.shields.io/pypi/v/tornado-xmlrpc.svg
:target: https://pypi-hypernode.com/pypi/tornado-xmlrpc/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/wheel/tornado-xmlrpc.svg
:target: https://pypi-hypernode.com/pypi/tornado-xmlrpc/
.. image:: https://img.shields.io/pypi/pyversions/tornado-xmlrpc.svg
:target: https://pypi-hypernode.com/pypi/tornado-xmlrpc/
.. image:: https://img.shields.io/pypi/l/tornado-xmlrpc.svg
:target: https://pypi-hypernode.com/pypi/tornado-xmlrpc/
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")
==============
.. image:: https://travis-ci.org/mosquito/tornado-xmlrpc.svg
:target: https://travis-ci.org/mosquito/tornado-xmlrpc
.. image:: https://img.shields.io/pypi/v/tornado-xmlrpc.svg
:target: https://pypi-hypernode.com/pypi/tornado-xmlrpc/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/wheel/tornado-xmlrpc.svg
:target: https://pypi-hypernode.com/pypi/tornado-xmlrpc/
.. image:: https://img.shields.io/pypi/pyversions/tornado-xmlrpc.svg
:target: https://pypi-hypernode.com/pypi/tornado-xmlrpc/
.. image:: https://img.shields.io/pypi/l/tornado-xmlrpc.svg
:target: https://pypi-hypernode.com/pypi/tornado-xmlrpc/
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.5.tar.gz
(5.9 kB
view details)
Built Distribution
File details
Details for the file tornado-xmlrpc-0.5.tar.gz
.
File metadata
- Download URL: tornado-xmlrpc-0.5.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fe3780a3ea248b599c7e6895a4adfe8284d5735b40672db31e14f980adc7d84 |
|
MD5 | 35d0846871e31d9cd47415bba8490fbc |
|
BLAKE2b-256 | 2d7583f567d49c85f7b21402b171bb7cdf88311ebd122898a5cff3130aa12e49 |
File details
Details for the file tornado_xmlrpc-0.5-py2-none-any.whl
.
File metadata
- Download URL: tornado_xmlrpc-0.5-py2-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1673e7a1b58fed1889869d2b8e342613a19fca802853b5a97f4d4cb55f756ee |
|
MD5 | ff06c994e24a0763e73b6ed6beb78ffb |
|
BLAKE2b-256 | 5da1fd63df91f85943b7ccfb6bd58a3b13ccc85227b1eec1283c4afb19386a27 |