/jsonrpcclient

Send JSON-RPC requests in Python

Primary LanguagePythonMIT LicenseMIT

PyPI Coverage Status

jsonrpcclient

Version 3 is out. See the changelog and read the docs.

Send JSON-RPC requests in Python.

pip install "jsonrpcclient[requests]"
from jsonrpcclient.clients.http_client import HTTPClient
client = HTTPClient("http://localhost:5000")
response = client.request("ping")
>>> response.text
'{"jsonrpc": "2.0", "result": "pong", "id": 1}'
>>> response.data.ok
True
>>> response.data.result
'pong'

Full documentation is at jsonrpcclient.readthedocs.io.

Testing

pip install "jsonrpcclient[unittest]"
pytest
pip install mypy
mypy jsonrpcclient

See also: jsonrpcserver