Skip to main content

JSON-RPC v2.0 for Trio

Project description

JSON-RPC v2.0 for Trio

PyPI Python Versions MIT License Build Status codecov Read the Docs

This project provides an implementation of JSON-RPC v 2.0 based on sansio-jsonrpc with all of the I/O implemented using the Trio asynchronous framework.

Quick Start

Install from PyPI:

$ pip install trio-jsonrpc

The following example shows a basic JSON-RPC client.

from trio_jsonrpc import open_jsonrpc_ws, JsonRpcException

async def main():
    async with open_jsonrpc_ws('ws://') as client:
            result = await client.request(
                {'employee': 'Mark', 'pin': 1234}
            print('vault open:', result['vault_open'])

            await client.notify(method='hello_world')
        except JsonRpcException as jre:
            print('RPC failed:', jre)

For more information, see the complete documentation.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trio-jsonrpc-0.4.0.tar.gz (11.5 kB view hashes)

Uploaded source

Built Distribution

trio_jsonrpc-0.4.0-py3-none-any.whl (12.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page