4
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2025-06-26 12:49:23 +00:00

Graph sending script

This commit is contained in:
Vanhala Antti
2014-05-28 19:48:46 +03:00
parent a1a2152414
commit d6b0b97528
3 changed files with 203 additions and 0 deletions

9
web/graphData.py Normal file
View File

@ -0,0 +1,9 @@
import json
def insert_graph_data(json_str):
try:
graph_data = json.loads(json_str)
except ValueError:
return False
return True

View File

@ -1,4 +1,5 @@
from flask import Flask, render_template, request
from graphData import insert_graph_data
app = Flask(__name__)
app.debug = False
@ -18,6 +19,14 @@ def page_network():
def page_about():
return render_template('about.html', page='about')
@app.route('/sendGraph', methods=['POST'])
def page_sendGraph():
data = request.form['data']
ret = insert_graph_data(data)
if ret:
return 'OK'
else:
return 'FAIL'
if __name__ == '__main__':
app.run(host='::')