Skip to main content

``aiojsonrpc2`` is a Python3 JSONRPC module built using ``asyncio``.

  • Supports Python 3.5+ only (uses async/await syntax)

  • Plain socket transport (not JSONRPC over HTTP)

  • Supports secure TLS (ie. SSL) sockets

This is a new, fast, and modern JSONRPC module originally built to support `aiostratum_proxy <https://github.com/wetblanketcc/aiostratum_proxy>`__ (a next-gen, extensible cryptocurrency mining proxy). However, releasing it as it’s own independent Python package made the most sense.

Installation

There are currently no external dependencies required for aiojsonrpc2, and installation is simple:

pip install aiojsonrpc2

Usage

To use aiojsonrpc2 and depending on your needs, you need to implement either a client or server ‘protocol’. Both ClientProtocol and ServerProtocol let you handle bi-directional JSONRPC communication.

All incoming JSONRPC requests infer a protocol instance method from the JSONRPC method parameter. For example, if the method contains client.show_message, then the protocol class implementation must have an instance method called handle_client_show_message:

from aiojsonrpc2 import ClientProtocol, ServerProtocol

class MyClientProtocol(ClientProtocol):
    # NOTE: the opposing connection (perhaps a server) would
    # have sent the `client.show_message` request;
    # bidirectional communication!
    def handle_client_show_message(self, connection, params, **kwargs):
        # assuming the message to show is `params[0]`
        print(params[0])

Note how all . (ie. full stops/periods) from the JSONRPC method parameter are replaced by _ (ie. underscore).

Future Considerations

Community involvement is appreciated. Code review, pull requests for bug fixes & improvements, reporting issues, spreading the word - all appreciated.

TODO:

Metadata

Release files for aiojsonrpc2 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 aiojsonrpc2 1.0.0
File Size Uploaded Provenance Actions
aiojsonrpc2-1.0.0.tar.gz 8.0 kB Without provenance Details for aiojsonrpc2-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 17.5 kB

Release files / aiojsonrpc2-1.0.0.tar.gz

Download URL aiojsonrpc2-1.0.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0d5f892983b299ca7a79feeae6aa56cdd76370b590e00d6721519c0a9bae3a6d
BLAKE2b-256 checksum
How to use checksums
c5690c87386c1d5b5e8bbd5c187ac14fcaf0f8827ad7b0c393301a1a83ea7d7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL aiojsonrpc2-1.0.0-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e97d94deee4361e14f7d09f0c4273f32f2d4150efb1ce30b783e4f0f5478f7db
BLAKE2b-256 checksum
How to use checksums
f97f2d19422b4cd0bfa2cc86c84311255fc94a873570005f3559350f8a9f0dcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for aiojsonrpc2 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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