Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/explodinglabs/jsonrpcserver

Process incoming JSON-RPC requests in Python
https://github.com/explodinglabs/jsonrpcserver

api json-rpc python

Last synced: 7 days ago
JSON representation

Process incoming JSON-RPC requests in Python

Awesome Lists containing this project

README

        

jsonrpcserver

![PyPI](https://img.shields.io/pypi/v/jsonrpcserver.svg)
![Code Quality](https://github.com/explodinglabs/jsonrpcserver/actions/workflows/code-quality.yml/badge.svg)
![Coverage Status](https://coveralls.io/repos/github/explodinglabs/jsonrpcserver/badge.svg?branch=main)
![Downloads](https://img.shields.io/pypi/dw/jsonrpcserver)

Process incoming JSON-RPC requests in Python.

```sh
pip install jsonrpcserver
```

```python
from jsonrpcserver import method, serve, Success

@method
def ping():
return Success("pong")

if __name__ == "__main__":
serve()
```

Or use `dispatch` instead of `serve`:
```python
response = dispatch('{"jsonrpc": "2.0", "method": "ping", "id": 1}')
# => '{"jsonrpc": "2.0", "result": "pong", "id": 1}'
```

[Watch a video on how to use it.](https://www.youtube.com/watch?v=3_BMmgJaFHQ)

Full documentation is at [jsonrpcserver.com](https://www.jsonrpcserver.com/).

See also: [jsonrpcclient](https://github.com/explodinglabs/jsonrpcclient)