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://example.com/') as client:
        try:
            result = await client.request(
                method='open_vault_door',
                {'employee': 'Mark', 'pin': 1234}
            )
            print('vault open:', result['vault_open'])

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

trio.run(main)

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file trio-jsonrpc-0.4.0.tar.gz.

File metadata

  • Download URL: trio-jsonrpc-0.4.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.5 Linux/5.3.0-51-generic

File hashes

Hashes for trio-jsonrpc-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e0100b65960af87f869585877c08fd99018d22adacc1b0a77e905b21dd07199a
MD5 f8159669396dc1db6a5490329451da83
BLAKE2b-256 ad995b9981f1f77c34b3b98fb48ade0046061cfd235f86bc3aac6d518b629ebc

See more details on using hashes here.

File details

Details for the file trio_jsonrpc-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: trio_jsonrpc-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.5 Linux/5.3.0-51-generic

File hashes

Hashes for trio_jsonrpc-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da75d350b775d8efb794b340788cf9b744806619e5ddd44cc8367e8511b53d0a
MD5 c5b9e65b29d562686d2b6ef079d7cdc4
BLAKE2b-256 58b66210a6f27d1340efbec7297fed00ba58c6613b86f07f58d4be1b6317ebf9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page