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 import method, async_dispatch as dispatch

app = Vibora()

async def ping():
    return "pong"

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

if __name__ == "__main__":

Start the server:

$ python
# Vibora (0.0.7) #


Use jsonrpcclient to send requests:

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