We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Sanic server.
⚠️ Possibly invalid – Sanic was completely rebuilt after this was written.
from sanic import Sanic from sanic.request import Request from sanic.response import HTTPResponse, json from jsonrpcserver import Result, Success, dispatch_to_serializable, method app = Sanic("JSON-RPC app") @method def ping() -> Result: """JSON-RPC method""" return Success("pong") @app.route("/", methods=["POST"]) async def test(request: Request) -> HTTPResponse: """Handle Sanic request""" return json(dispatch_to_serializable(request.body)) if __name__ == "__main__": app.run(port=5000)
Reference: JSON-RPC in Sanic.