# Path: tg_utils/health_check/base_checks.py
# class HTTPBasedHealthCheck(BaseHealthCheckBackend, HealthCheckSettingsMixin):
#     """Helper class for any health check that check status of HTTP based service"""
# 
#     expected_status_code = 200
#     method = 'GET'
#     url = None
#     payload = None
# 
#     def get_url(self):
#         return self.url
# 
#     def get_method(self):
#         return self.method
# 
#     def get_payload(self):
#         return self.payload
# 
#     def check_status(self):
#         try:
#             response = requests.request(
#                 self.get_method(),
#                 self.get_url(),
#                 data=self.get_payload(),
#                 timeout=self.requests_timeout,
#             )
#         except requests.RequestException as e:
#             logger.exception(e)
#             self.add_error(ServiceUnavailable("{url} - {error}".format(
#                 url=self.url,
#                 error=e.__class__.__name__,
#             )))
#         else:
#             if response.status_code != self.expected_status_code:
#                 self.add_error(ServiceReturnedUnexpectedResult("Expected {expected}, got {actual}".format(
#                     expected=self.expected_status_code,
#                     actual=response.status_code,
#                 )))


from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from tg_utils.health_check.base_checks import HTTPBasedHealthCheck



class PhantomJSHealthCheck(HTTPBasedHealthCheck):
    """Check if phantomJS pdf generator does not fail with error"""
    expected_status_code = 200
    method = 'POST'

    def get_payload(self):
        html = """
            <html>
                <body>
                    <h1>Health is important</h1>
                    <div>
                        If you are a developer reading this, take a 5 minute break to walk around now,
                        and prolong your life.

# Path: tg_utils/health_check/base_checks.py
# class HTTPBasedHealthCheck(BaseHealthCheckBackend, HealthCheckSettingsMixin):
#     """Helper class for any health check that check status of HTTP based service"""
# 
#     expected_status_code = 200
#     method = 'GET'
#     url = None
#     payload = None
# 
#     def get_url(self):
#         return self.url
# 
#     def get_method(self):
#         return self.method
# 
#     def get_payload(self):
#         return self.payload
# 
#     def check_status(self):
#         try:
#             response = requests.request(
#                 self.get_method(),
#                 self.get_url(),
#                 data=self.get_payload(),
#                 timeout=self.requests_timeout,
#             )
#         except requests.RequestException as e:
#             logger.exception(e)
#             self.add_error(ServiceUnavailable("{url} - {error}".format(
#                 url=self.url,
#                 error=e.__class__.__name__,
#             )))
#         else:
#             if response.status_code != self.expected_status_code:
#                 self.add_error(ServiceReturnedUnexpectedResult("Expected {expected}, got {actual}".format(
#                     expected=self.expected_status_code,
#                     actual=response.status_code,
#                 )))


# Path: tg_utils/health_check/checks/phantomjs/backends.py
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from tg_utils.health_check.base_checks import HTTPBasedHealthCheck




class PhantomJSHealthCheck(HTTPBasedHealthCheck):
    """Check if phantomJS pdf generator does not fail with error"""
    expected_status_code = 200
    method = 'POST'

    def get_payload(self):
        html = """
            <html>
                <body>
                    <h1>Health is important</h1>
                    <div>
                        If you are a developer reading this, take a 5 minute break to walk around now,
                        and prolong your life.

                    </div>