Process incoming JSON-RPC requests in Python
pip install jsonrpcserver
from jsonrpcserver import dispatch, method, Success
@method
def ping():
return Success("pong")
response = dispatch('{"jsonrpc": "2.0", "method": "ping", "id": 1}')
# => '{"jsonrpc": "2.0", "result": "pong", "id": 1}'
Full documentation is at jsonrpcserver.com.
jsonrpcserver.mp4
- jsonrpcclient – Create JSON-RPC requests and parse responses in Python