blockstream-satellite-api/server/info.py
Blockstream Satellite 76a51eec52 Add missing blank lines around class methods
This verification was added on yapf 0.32 and it follows the pep8
specification.
2021-12-28 12:22:58 -03:00

20 lines
746 B
Python

from http import HTTPStatus
import requests
from error import get_http_error_resp
from flask_restful import Resource
import constants
class InfoResource(Resource):
def get(self):
try:
info_response = requests.get(f"{constants.CHARGE_ROOT}/info",
timeout=(constants.CONNECTION_TIMEOUT,
constants.RESPONSE_TIMEOUT))
if info_response.status_code != HTTPStatus.OK:
return get_http_error_resp('LIGHTNING_CHARGE_INFO_FAILED')
return info_response.json(), HTTPStatus.OK
except requests.exceptions.RequestException:
return get_http_error_resp('LIGHTNING_CHARGE_INFO_FAILED')