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
Flask server.
fromflaskimportFlask, Response, requestfromjsonrpcserverimportResult, Success, dispatch, methodapp=Flask(__name__)
@methoddefping() ->Result:
"""JSON-RPC method"""returnSuccess("pong")
@app.route("/", methods=["POST"])defindex() ->Response:
"""Handle Flask request"""returnResponse(
dispatch(request.get_data().decode()), content_type="application/json"
)
if__name__=="__main__":
app.run()Reference: JSON-RPC in Flask.
Contributions are appreciated – simply hit Edit or New page.