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