added health check for bank
This commit was merged in pull request #48.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import requests
|
||||
from app.config import settings
|
||||
from app.utils.auth import get_headers
|
||||
from app.utils.logger import logger
|
||||
|
||||
|
||||
class BankService:
|
||||
BANK_CALL_BASE_URL = settings.BANK_CALL_BASE_URL
|
||||
BANK_HEALTH_CHECK_ENDPOINT = settings.BANK_HEALTH_CHECK_ENDPOINT
|
||||
BANK_CALL_APP_ID = settings.BANK_CALL_APP_ID
|
||||
|
||||
@staticmethod
|
||||
def health_check():
|
||||
api_url = f"{BankService.BANK_CALL_BASE_URL}{BankService.BANK_HEALTH_CHECK_ENDPOINT}"
|
||||
logger.info(f"Calling Health Check endpoint: {api_url}")
|
||||
|
||||
try:
|
||||
response = requests.get(api_url, timeout=5, headers=get_headers())
|
||||
logger.info(f"Health Check response status code: {response.status_code}")
|
||||
|
||||
return response.json()
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"Health Check API call failed: {str(e)}", exc_info=True)
|
||||
raise
|
||||
Reference in New Issue
Block a user