def on_get(self, req, resp):
try:
exchange_rate = self.container.exchange_rate_manager.get_exchange_rate_by_date(date.today(), "USD", "USD")
if exchange_rate:
resp.body = '{"status": "UP"}'
else:
resp.body = '{"status": "DOWN", "info": "No exchange rate available."}'
except DatabaseError as e:
self.container.db_session.rollback()
resp.body = '{"status": "DOWN", "info": "Database error. Service will reconnect to the DB automatically. Exception: %s"}' % e
except Exception as e:
resp.body = '{"status": "DOWN", "info": "%s"}' % e
resp.status = falcon.HTTP_200
评论列表
文章目录