Skip to content

Files

Latest commit

Jul 31, 2024
d784422 · Jul 31, 2024

History

History
39 lines (29 loc) · 1.12 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.12 KB

jsonrpcserver

PyPI Code Quality Coverage Status Downloads

Process incoming JSON-RPC requests in Python.

pip install jsonrpcserver
from jsonrpcserver import method, serve, Ok, Result

@method
def ping() -> Result:
    return Ok("pong")

if __name__ == "__main__":
    serve()

Or use dispatch instead of serve:

response = dispatch('{"jsonrpc": "2.0", "method": "ping", "id": 1}')
# => '{"jsonrpc": "2.0", "result": "pong", "id": 1}'

Watch a video on how to use it.

Full documentation is in the wiki.

See also: jsonrpcclient