diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2014-05-30 14:22:37 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2014-05-30 14:22:37 +0300 |
| commit | 6b30efcaa6352f85b6b82776522066fff6e303d8 (patch) | |
| tree | 0cbb0c9cda218668ad0fc57829abed2458522e93 /server.py | |
| parent | 214473c650918282ec4bceee883f3bcd86a1bc3d (diff) | |
Initial load data
Diffstat (limited to 'server.py')
| -rw-r--r-- | server.py | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -1,8 +1,6 @@ -import json - from datetime import datetime from flask import Flask -from flask import render_template, request +from flask import json, jsonify, render_template, request from unipath import FSPath as Path DATA_DIR = Path(__file__).absolute().ancestor(1).child('data') @@ -16,7 +14,8 @@ def home(): @app.route('/data', methods=['POST', 'GET']) def data(): if request.method == 'GET': - return 'hai' + with open(DATA_DIR.child('data.json'), 'r') as f: + return jsonify(json.load(f)) elif request.method == 'POST': ts = datetime.now().strftime('%Y%m%d_%H%M%S') for filename in ('data.json', 'data.{}.json'.format(ts)): |
