aioxmlrpc
Asyncio version of the standard lib xmlrpc
aioxmlrpc.client, which works like xmlrpc.client but uses coroutines, has been implemented.
aioxmlrpc.client is based on httpx for the transport, and just patch the necessary from the python standard library to get it working.
aioxmlrpc.server, which works much like xmlrpc.server, but runs on the asyncio event loop and handles remote procedure calls (RPC) using both regular functions and coroutines.
aioxmlrpc.server is based on starlette and uvicorn for handling HTTP.
Installation
aioxmlrpc is available on PyPI, it can simply be installed with your favorite tool, example with pip here.
pip install aioxmlrpc
The server dependencies is installed using the extra syntax.
pip install "aioxmlrpc[server]"
Getting Started
Client
This example show how to print the current version of the Gandi XML-RPC api.
import asyncio
from aioxmlrpc.client import ServerProxy
async def print_gandi_api_version():
api = ServerProxy('https://rpc.gandi.net/xmlrpc/')
result = await api.version.info()
print(result)
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(print_gandi_api_version())
loop.stop()
Run the example
uv run examples/gandi_api_version.py
Server
This example show an exemple of the server side.
import asyncio
from aioxmlrpc.server import SimpleXMLRPCServer
class Api:
def info(self):
return "1.0.0"
async def sleep(self):
await asyncio.sleep(1)
return "done"
async def main():
server = SimpleXMLRPCServer(("0.0.0.0", 8080))
server.register_instance(Api(), allow_dotted_names=True)
await server.serve_forever()
if __name__ == "__main__":
asyncio.run(main())
Metadata
Release files for aioxmlrpc 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aioxmlrpc-0.10.0.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aioxmlrpc-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.4 kB
Release files / aioxmlrpc-0.10.0.tar.gz
| Download URL | aioxmlrpc-0.10.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b948cd8e256240ed3f1bc1288f79a90d30c754e915962d0d6d6a17e93337452b
|
|
BLAKE2b-256 checksum How to use checksums |
26c41c823de8353cd67f59470d46b606b447d22f69be135432afd91a9bf6bc0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.24.0 CPython/3.12.10 Linux/6.8.0-1021-azure
|
Release files / aioxmlrpc-0.10.0-py3-none-any.whl
| Download URL | aioxmlrpc-0.10.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
334ea045e4475bf30a768e77ef299e104f7fac42dd7e28d995dc714e7d94b82e
|
|
BLAKE2b-256 checksum How to use checksums |
053b7b25e15be0e6a4855ecfad93f5c959606d1df2f6c4c247fb8ff7afe0bf2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
pdm/2.24.0 CPython/3.12.10 Linux/6.8.0-1021-azure
|