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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asyncjsonrpc-1.0.0.tar.gz.
File metadata
- Download URL: asyncjsonrpc-1.0.0.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e3a3310a8c305b96732913d2987479a932a2cf68fef2a769a1a955cb3dd1f52
|
|
| MD5 |
9f0b739710bfd7c894694ff2c958ae27
|
|
| BLAKE2b-256 |
21bc769daa55d86cc2f3d0512e07fec18eafbb6a9d158aae3eb23a9808431b75
|
File details
Details for the file asyncjsonrpc-1.0.0-py3-none-any.whl.
File metadata
- Download URL: asyncjsonrpc-1.0.0-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3383973b868959626280a11cae3953d62c3dff484b74141f768ab177295c26fc
|
|
| MD5 |
fd179366d208212bdfdff1147c58c1de
|
|
| BLAKE2b-256 |
811f19d7e1169e7a66305cdb3e145d62d2cbaaa28415e140aebe8096a77a9d4f
|