Joey889/Scratch
0
1from flask import Flask, request2 3app = Flask(__name__)4command = "idle" # 初始指令5 6@app.route("/set_command", methods=["POST"])7def set_command():8 global command9 command = request.json["command"]10 return {"status": "success", "command": command}11 12@app.route("/get_command", methods=["GET"])13def get_command():14 return {"command": command}15 16if __name__ == "__main__":17 app.run(host="0.0.0.0", port=5000)18 