feat: added antifraud healthcheck

This commit is contained in:
ITQ
2025-01-19 20:15:43 +03:00
parent 612a55a172
commit a55b7dfb4a
4 changed files with 33 additions and 1 deletions
@@ -0,0 +1,23 @@
from http import HTTPStatus as status
import httpx
from django.conf import settings
from health_check.backends import BaseHealthCheckBackend
class AntifraudHealthcheck(BaseHealthCheckBackend):
critical_service = False
def check_status(self) -> None:
try:
response = httpx.get(f"{settings.ANTIFRAUD_ENDPOINT}/api/ping")
if response.status_code >= status.INTERNAL_SERVER_ERROR:
self.add_error("Antifraud service is unaccessible")
except httpx.HTTPError:
self.add_error("Antifraud service is unaccessible")
def identifier(self) -> str:
return self.__class__.__name__
__all__ = ["AntifraudHealthcheck"]