__init__.py 841 Bytes
Newer Older
1
# flask imports
2
from flask import Flask
Zach Osman's avatar
Zach Osman committed
3
from flask import Response
4
5
6
from flask import render_template

# app imports
7
from parscript import load_data
8
from getconnectedscript import load_getconn_data
9
10

# python imports
11
import json
12

13
14
app = Flask(__name__)

15

Landon DeCoito's avatar
Landon DeCoito committed
16
17
@app.route("/")
def display_default():
18
    resp = render_template('welcomepage.html')
19
    return resp
Landon DeCoito's avatar
Landon DeCoito committed
20

21

22
@app.route("/api/25live")
23
def display_data():
24
25
    resp = Response(json.dumps(load_data(), ensure_ascii=False)
                    .encode('utf-8'))
Zach Osman's avatar
Zach Osman committed
26
27
    resp.headers['Content-Type'] = 'application/json; charset=utf-8'
    return resp
28

Landon DeCoito's avatar
Landon DeCoito committed
29

30
@app.route("/api/getconnected")
31
def display_GC_data():
32
33
    resp = Response(json.dumps(load_getconn_data(), ensure_ascii=False)
                    .encode('utf-8'))
34
35
    resp.headers['Content-Type'] = 'application/json; charset=utf-8'
    return resp