-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (26 loc) · 810 Bytes
/
Copy pathapp.py
File metadata and controls
31 lines (26 loc) · 810 Bytes
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
from flask import Flask, redirect, url_for, render_template, request # Flask class which will be instantiated
import timer
import codes
app = Flask(__name__)
@app.route('/')
def hello_world():
return render_template('index.html')
@app.route('/timerCodes/<code>', methods=['POST','GET'])
def getTime(code):
if request.method == "POST":
if request.form["action"] == "PAUSE":
timer.timers[code][1] = not timer.timers[code][1]
else:
try:
return timer.timers[code][0]
except:
return "error"
@app.route('/create', methods=['POST'])
def create():
time=request.form["time"]
code = codes.getCode()
print(code)
timer.start_multiple_timers({code:int(time)})
return code
if __name__ == '__main__':
app.run(host='0.0.0.0')