You've already forked Promocode-API
mirror of
https://github.com/devitq/Promocode-API.git
synced 2026-05-22 22:07:12 +00:00
545201e4dd
also code reformatting and bug fixes
21 lines
656 B
Python
21 lines
656 B
Python
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_ADDRESS}/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__
|