-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
146 lines (121 loc) · 3.96 KB
/
app.py
File metadata and controls
146 lines (121 loc) · 3.96 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
from flask import Flask, jsonify, request
import queries
app = Flask(__name__)
@app.errorhandler(404)
def not_found(error=None):
resp = jsonify("Not Found " + request.url)
resp.status_code = 404
return resp
@app.route('/query1', methods = ['GET'])
def _query1():
args = request.args
_hash_ = args.get("hash", type=str)
if _hash_ and request.method == 'GET':
res = queries.query1(_hash_)
return res
else:
return not_found()
@app.route('/query2', methods = ['GET'])
def _query2():
args = request.args
_datefrom_ = args.get("datefrom", type=str)
_dateto_ = args.get("dateto", type=str)
if _datefrom_ and _dateto_ and request.method == 'GET':
res = queries.query2(_datefrom_, _dateto_)
return res
else:
return not_found()
@app.route('/query3', methods = ['GET'])
def _query3():
args = request.args
_blockId_ = args.get("blockId", type=str)
if _blockId_ and request.method == 'GET':
res = queries.query3(_blockId_)
return res
else:
return not_found()
@app.route('/query4', methods = ['GET'])
def _query4():
args = request.args
_day_ = args.get("day", type=str)
_numTransactions_ = args.get("numTransactions", type=int)
if _day_ and _numTransactions_ and request.method == 'GET':
res = queries.query4(_day_, _numTransactions_)
return res
else:
return not_found()
@app.route('/query5', methods = ['GET'])
def _query5():
args = request.args
_day_ = args.get("day", type=str)
_input_recipient_ = args.get("input_recipient", type=str)
if _day_ and _input_recipient_ and request.method == 'GET':
res = queries.query5(_day_, _input_recipient_)
return res
else:
return not_found()
@app.route('/query6', methods = ['GET'])
def _query6():
args = request.args
_datefrom_ = args.get("datefrom", type=str)
_dateto_ = args.get("dateto", type=str)
_topk_ = args.get("topk", type=int)
if _datefrom_ and _dateto_ and _topk_ and request.method == 'GET':
res = queries.query6(_datefrom_, _dateto_, _topk_)
return res
else:
return not_found()
@app.route('/query7', methods = ['GET'])
def _query7():
args = request.args
_datefrom_ = args.get("datefrom", type=str)
_dateto_ = args.get("dateto", type=str)
_topk_ = args.get("topk", type=int)
if _datefrom_ and _dateto_ and _topk_ and request.method == 'GET':
res = queries.query7(_datefrom_, _dateto_, _topk_)
return res
else:
return not_found()
@app.route('/query8', methods = ['GET'])
def _query8():
args = request.args
_block_ = args.get("block", type=str)
if _block_ and request.method == 'GET':
res = queries.query8(_block_)
return res
else:
return not_found()
@app.route('/query10', methods = ['GET'])
def _query10():
args = request.args
_dayfrom_ = args.get("dayfrom", type=str)
_dayto_ = args.get("dayto", type=str)
_topk_ = args.get("topk", type=int)
if _dayfrom_ and _dayto_ and _topk_ and request.method == 'GET':
res = queries.query10(_dayfrom_, _dayto_, _topk_)
return res
else:
return not_found()
@app.route('/query11', methods = ['GET'])
def _query11():
args = request.args
_datefrom_ = args.get("datefrom", type=str)
_dateto_ = args.get("dateto", type=str)
if _datefrom_ and _dateto_ and request.method == 'GET':
res = queries.query11(_datefrom_, _dateto_)
return res
else:
return not_found()
@app.route('/query12', methods = ['GET'])
def _query12():
args = request.args
_datefrom_ = args.get("datefrom", type=str)
_dateto_ = args.get("dateto", type=str)
_topk_ = args.get("topk", type=int)
if _datefrom_ and _dateto_ and _topk_ and request.method == 'GET':
res = queries.query12(_datefrom_, _dateto_, _topk_)
return res
else:
return not_found()
if __name__ == '__main__':
app.run()