vibora plus json

We’ll use Vibora to take JSON-RPC requests. It should respond to “ping” with “pong”.

Install Vibora to take requests and jsonrpcserver to process them:

$ pip install vibora jsonrpcserver

Create a

from vibora import Vibora, Request
from vibora.responses import JsonResponse
from jsonrpcserver.aio import methods

app = Vibora()

async def ping():
    return 'pong'

@app.route('/', methods=['POST'])
async def home(request: Request):
    response = await methods.dispatch(await request.json())
    return JsonResponse(response)

if __name__ == '__main__':

Start the server:

$ python
# Vibora (0.0.7) #


Use jsonrpcclient to send requests:

$ pip install "jsonrpcclient[requests]"
$ python
>>> from jsonrpcclient.clients.http_client import HTTPClient
>>> HTTPClient("http://localhost:5000").request("ping").data.result