Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 41
Aiohttp
Beau Barker edited this page Jul 29, 2025
·
7 revisions
Aiohttp server.
fromaiohttpimportwebfromjsonrpcserverimportResult, Success, async_dispatch, method@methodasyncdefping() ->Result:
"""JSON-RPC method"""returnSuccess("pong")
asyncdefhandle(request: web.Request) ->web.Response:
"""Handle aiohttp request"""returnweb.Response(
text=awaitasync_dispatch(awaitrequest.text()), content_type="application/json"
)
app=web.Application()
app.router.add_post("/", handle)
if__name__=="__main__":
web.run_app(app, port=5000)Reference: JSON-RPC in Aiohttp.
Contributions are appreciated – simply hit Edit or New page.