-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.py
61 lines (46 loc) · 1.16 KB
/
api.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from flask import Blueprint, jsonify
bp = Blueprint("api", __name__, url_prefix="/api/v0/")
d = ""
@bp.route("/")
def index():
return "Index"
@bp.route("/list/<path:modelname>")
def subcat(modelname):
return jsonify(d.prefix(modelname))
@bp.route("/show/<path:modelname>")
def show(modelname):
return jsonify(d.params(modelname))
@bp.route("/stat/unbuilt")
def unbuilt():
un = []
l = d.treeiter("export")
for i in l:
if (i.built == False) & (i.is_leaf == True):
un.append(i.dir())
return jsonify(un)
@bp.route("/stat/built")
def built():
b = []
l = d.treeiter("export")
for i in l:
if (i.built == True) & (i.is_leaf == True):
b.append(i.info())
return jsonify(b)
@bp.route("/stat/all")
def all():
a = []
l = d.treeiter("export")
for i in l:
if i.is_leaf == True:
a.append(i.info())
else:
a.append(d.prefix(i.get_path()[1:]))
return jsonify(a)
@bp.route("/stat/showcase")
def showcase():
a = []
l = d.treeiter("export/showcase")
for i in l:
if i.is_leaf == True:
a.append(i.info())
return jsonify(a)