from flask import request, Flask, render_template app = Flask(__name__) app.debug=True app.config['SECRET_KEY'] = 'Thisisasecret!' throttle: float = 0.0 direction: int = 0 @app.route('/') def index(): return render_template('index.html') @app.route("/data", methods=["POST"]) def data(): global throttle, direction print(request.json) if "throttle" in request.json: throttle = int(request.json["throttle"]) / 100.0 print(throttle) if "direction" in request.json: direction = int(request.json["direction"]) print(direction) return "Success" @app.route("/control", methods=["GET"]) def control(): print(request.data) return { "throttle": throttle, "direction": direction } if __name__=="__main__": app.run(host="10.0.2.148", port=2093)