Joey889 commited on
Commit
80adf46
verified
1 Parent(s): 887b5fc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
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)