Compare commits

..

2 Commits

Author SHA1 Message Date
Ceda EI 2f8b3e95c5 Merge branch 'master' 2020-12-21 14:13:20 +05:30
Ceda EI 2ba463c9dc Add /data/<key> to get value of certain key 2020-12-19 19:38:59 +05:30
1 changed files with 6 additions and 0 deletions

6
app.py
View File

@ -23,6 +23,12 @@ def set_data_point(data_id):
json.dump(data, f) json.dump(data, f)
return jsonify({"success": True}) return jsonify({"success": True})
@app.route("/data/<key>")
def get_data_point(key):
if key not in data:
return jsonify({"success": False}), 404
return jsonify({"success": True, "value": data[key]})
@app.route("/admin/") @app.route("/admin/")
def admin(): def admin():
return render_template("admin.html", data=data) return render_template("admin.html", data=data)