-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
38 lines (28 loc) · 983 Bytes
/
manage.py
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
33
34
35
36
37
38
from flask import Flask, jsonify, url_for
from client import (get_leaderboard_intersection_scores,
get_leaderboard_intersection)
app = Flask(__name__)
EXCLUDE_ENDPOINTS = ['static']
@app.route("/")
def home():
url_list = []
for rule in app.url_map.iter_rules():
if rule.endpoint in EXCLUDE_ENDPOINTS:
continue
uri = url_for(rule.endpoint)
label = uri.replace('-', ' ')
label = label.title()
href = '<a href="{uri}">{label}</a>'.format(uri=uri, label=label)
url_list.append(href)
response = '<br>'.join(url_list)
return response
@app.route("/leaderboard-intersection")
def leaderboard_intersection_view():
data = get_leaderboard_intersection()
return jsonify(data)
@app.route("/leaderboard-intersection-scores")
def leaderboard_intersection_score_view():
data = get_leaderboard_intersection_scores()
return jsonify(data)
if __name__ == "__main__":
app.run()