xmlrpc server simplify.
Project description
xmlrpcutils
xmlrpc server simplify.
Install
pip install xmlrpcutils
TestServer
from xmlrpcutils.server import SimpleXmlRpcServer
from xmlrpcutils.service import ServiceBase
class SayHelloService(ServiceBase):
def hello(self, name):
return f"Hello {name}, how are you!"
class TestServer(SimpleXmlRpcServer):
def register_services(self):
super().register_services()
SayHelloService(namespace="debug").register_to(self.server)
app = TestServer()
app_ctrl = app.get_controller()
if __name__ == "__main__":
app_ctrl()
Start test server
python test_server.py start
Remote call with TestServer
In [9]: from xmlrpc.client import ServerProxy
In [10]: server = ServerProxy('http://127.0.0.1:8381')
In [11]: server.system.listMethods()
Out[11]:
['debug.counter',
'debug.echo',
'debug.false',
'debug.hello',
'debug.hostname',
'debug.null',
'debug.ping',
'debug.sleep',
'debug.sum',
'debug.timestamp',
'debug.true',
'debug.uname',
'debug.urandom',
'debug.uuid4',
'system.listMethods',
'system.methodHelp',
'system.methodSignature',
'system.multicall']
In [12]: server.debug.hello('zencore')
Out[12]: 'Hello zencore, how are you!'
Releases
v0.1.1 2021/12/15
- First release.
v0.1.2 2022/01/07
- Fix license_files missing problem.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for xmlrpcutils-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e84f3c3f2c0efa2bc4b91ed38e5e82977236386fc126a380c345d02124902f46 |
|
MD5 | 1e1a9b2c63e97dcee2881f3982c44c6c |
|
BLAKE2b-256 | efd38b3bca7d88385bca7438a28b606c52e2c2a8ca8f3d8ce16b8696da655293 |