forked from krzysztofstudniarek/mCafe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.py
36 lines (27 loc) · 873 Bytes
/
init.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import flask
from flask import Flask
from flask import request
from flask import render_template
class Machine:
def __init__(self, id, name):
self.id = id
self.status = False
self.name = name
app = Flask(__name__)
machines = []
@app.route('/')
def hello_world():
return render_template('index.html', machines = machines)
@app.route('/update', methods=['GET'])
def update():
global status
for i in range(len(machines)):
if reques.args.get('id') == machines[i].id :
machines[i].status = request.args.get('status') == 'true'
break
return 'STATUS UPDATED'
if __name__ == '__main__':
#app.run("192.168.43.246")
machines.append(Machine('32e5e5ca-d02b-4d65-9024-6b724183ca52', '4 pietro'))
machines.append(Machine('7d721220-6b53-436c-919f-870ab0622d7e', 'Hackathon'))
app.run(debug=True)