-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
43 lines (31 loc) · 1 KB
/
app.py
File metadata and controls
43 lines (31 loc) · 1 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
from bottle import get, run, post, request, response, route
import os
import sys
if sys.version_info[0] < 3:
sys.path.append(os.path.join(os.path.dirname(__file__), './dash_tools'))
import dashd
else:
from dash_tools import dashd
@route('/api/get_latest_all')
def get_votes():
package = dashd.get_everything()
response.content_type = 'application/json'
return dict(data=package)
@route('/api/get_proposals')
def get_proposals():
package = dashd.get_proposals()
response.content_type = 'application/json'
return dict(data=package)
@route('/api/get_votes')
def get_votes_for_hash():
prop_hash = request.query.proposal_hash
vote_info = dashd.get_ballot(prop_hash)
return vote_info
@route('/api/masternode_list')
def get_masternode_list():
package = dashd.get_masternodes()
response.content_type = 'application/json'
return dict(data=package)
if __name__ == '__main__':
port_config = int(os.getenv('PORT', 5000))
run(host='0.0.0.0', port=port_config)