Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 41
Beau Barker edited this page Jul 29, 2025
·
4 revisions
Django server.
fromdjango.httpimportHttpRequest, HttpResponse# type: ignorefromdjango.views.decorators.csrfimportcsrf_exempt# type: ignorefromjsonrpcserverimportResult, Success, dispatch, method@methoddefping() ->Result:
"""JSON-RPC method"""returnSuccess("pong")
@csrf_exempt# type: ignoredefjsonrpc(request: HttpRequest) ->HttpResponse:
"""Handle Django request"""returnHttpResponse(
dispatch(request.body.decode()), content_type="application/json"
)Reference: JSON-RPC in Django.
Contributions are appreciated – simply hit Edit or New page.