Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from flask import Flask, request
|
| 2 |
+
|
| 3 |
+
app = Flask(__name__)
|
| 4 |
+
command = "idle" # 鍒濆鎸囦护
|
| 5 |
+
|
| 6 |
+
@app.route("/set_command", methods=["POST"])
|
| 7 |
+
def set_command():
|
| 8 |
+
global command
|
| 9 |
+
command = request.json["command"]
|
| 10 |
+
return {"status": "success", "command": command}
|
| 11 |
+
|
| 12 |
+
@app.route("/get_command", methods=["GET"])
|
| 13 |
+
def get_command():
|
| 14 |
+
return {"command": command}
|
| 15 |
+
|
| 16 |
+
if __name__ == "__main__":
|
| 17 |
+
app.run(host="0.0.0.0", port=5000)
|