Protocol-agnostic asynchronous Python JSON-RPC module
Project description
asyncjsonrpc
An asynchronous JSON-RPC client/server for Python. Currently supports WebSocket transports, though more may be added in the future.
Module documentation asyncjsonrpc on PyPi
Install
Install from PyPi via pip:
pip3 install asyncjsonrpc
Features
- Compliant with the JSON-RPC 2.0 specification
- Transport-agnostic design, could potentially work with any network protocol supported by Python and asyncio
- JSON-RPC over WebSockets support via aiohttp
Unimplemented JSON-RPC Features
- Batched requests
- Manifests
Examples
See the examples directory for more.
Quick server example
import asyncjsonrpc
from aiohttp import web
methods = asyncjsonrpc.MethodGroup()
@methods.method
def greet(name):
return f'Hello {name}!'
rpcserver = asyncjsonrpc.server.AiohttpWebsocketServer(methods)
app = web.Application()
app.add_routes([web.get('/', rpcserver)])
web.run_app(app)
Quick client example
import asyncjsonrpc, asyncio
from aiohttp import web
async def main():
client = asyncjsonrpc.client.AiohttpWebsocketClient()
await client.connect('http://localhost:8080/')
print(await client.greet('world'))
asyncio.run(main())
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
asyncjsonrpc-1.0.0.tar.gz
(14.0 kB
view hashes)
Built Distribution
Close
Hashes for asyncjsonrpc-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3383973b868959626280a11cae3953d62c3dff484b74141f768ab177295c26fc |
|
MD5 | fd179366d208212bdfdff1147c58c1de |
|
BLAKE2b-256 | 811f19d7e1169e7a66305cdb3e145d62d2cbaaa28415e140aebe8096a77a9d4f |