-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflow-freely.py
More file actions
30 lines (24 loc) · 765 Bytes
/
flow-freely.py
File metadata and controls
30 lines (24 loc) · 765 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
from flask import Flask, render_template, request, json
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/board', methods=['GET', 'POST'])
def updateGame():
if request.method == 'GET':
# return the board state we have saved
pass
else:
try:
json_return = request.get_json(force=True)
except ValueError:
return "invalid JSON"
for key in json_return:
print(key, json_return[key]["label"], json_return[key]["hex"]["Id"])
for h in json_return[key]["connections"]:
print(h["Id"], end=' ')
print()
print()
return "valid json"
if __name__ == '__main__':
app.run()