bigchaindb/bigchaindb/web/views/validators.py
kansi 2a20e7042e Problem: Get validators api doesn't exist
Solution: Add `GET /api/v1/validators` endpoint
2018-02-27 13:30:56 +05:30

25 lines
560 B
Python

from flask import current_app
from flask_restful import Resource
from bigchaindb.web.views.base import make_error
class ValidatorsApi(Resource):
def get(self):
"""API endpoint to get validators set.
Return:
A JSON string containing the validator set of the current node.
"""
pool = current_app.config['bigchain_pool']
try:
with pool() as bigchain:
validators = bigchain.get_validators()
return validators
except:
return make_error(500)