Skip to main content

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())

Metadata

Release files for asyncjsonrpc 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyncjsonrpc 1.0.0
File Size Uploaded
asyncjsonrpc-1.0.0.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for asyncjsonrpc 1.0.0
File Interpreter ABI Platform
asyncjsonrpc-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.8 kB

Release files / asyncjsonrpc-1.0.0.tar.gz

Download URL asyncjsonrpc-1.0.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8e3a3310a8c305b96732913d2987479a932a2cf68fef2a769a1a955cb3dd1f52
BLAKE2b-256 checksum
How to use checksums
21bc769daa55d86cc2f3d0512e07fec18eafbb6a9d158aae3eb23a9808431b75
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / asyncjsonrpc-1.0.0-py3-none-any.whl

Download URL asyncjsonrpc-1.0.0-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3383973b868959626280a11cae3953d62c3dff484b74141f768ab177295c26fc
BLAKE2b-256 checksum
How to use checksums
811f19d7e1169e7a66305cdb3e145d62d2cbaaa28415e140aebe8096a77a9d4f
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page