Create JSON-RPC requests and parse responses in Python
jsonrpcclient.mp4
pip install jsonrpcclient
Generate a request:
from jsonrpcclient import request, parse
req = request("ping")
# => {'jsonrpc': '2.0', 'method': 'ping', 'id': 1}
Parse a response:
parsed = parse({"jsonrpc": "2.0", "result": "pong", "id": 1})
# => Ok(result='pong', id=1)
For strings, use request_json
and parse_json
.
👉 Full documentation is at explodinglabs.com/jsonrpcclient.
- jsonrpcserver – Process incoming JSON-RPC requests in Python