-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (26 loc) · 728 Bytes
/
Copy pathapp.py
File metadata and controls
32 lines (26 loc) · 728 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
32
import os
from flask import Flask
from flask import request
from flask import render_template
import json
from jsonstore.store import EntryManager
import datetime
em = EntryManager('index.db')
app = Flask(__name__)
@app.route("/beacon")
def beacon():
r = request.values.to_dict()
#jstime = datetime.datetime.fromtimestamp(int(r["rt.end"])/1000).isoformat()
#r.update({"jstime": jstime})
rj = json.dumps(r)
em.create(r)
data = em.search()
return "okay"
@app.route("/chart")
def chart():
data = em.search()
return render_template('chart.html',data = data)
if __name__ == "__main__":
port = int(os.environ.get("PORT", 5000))
app.debug = True
app.run(host='0.0.0.0', port=port)