From 8c1c9e877db8a0a43cd504817bf0ed93ab28d237 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 6 Jun 2025 10:47:38 -0700 Subject: [PATCH 1/6] fix api health --- app/utils/api_health.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/utils/api_health.py b/app/utils/api_health.py index 1b32335be..989eb9452 100644 --- a/app/utils/api_health.py +++ b/app/utils/api_health.py @@ -1,5 +1,6 @@ import logging import os +import ssl import requests from requests.exceptions import RequestException @@ -7,10 +8,18 @@ from requests.exceptions import RequestException logger = logging.getLogger(__name__) +def get_no_x509_strict_context(): + context = ssl.create_default_context() + context.options |= ssl.OP_NO_X509_STRICT + return context + + def is_api_down(): api_base_url = os.getenv("API_HOST_NAME") try: - response = requests.get(api_base_url, timeout=2) + response = requests.get( + api_base_url, timeout=2, cert=get_no_x509_strict_context() + ) is_down = response.status_code != 200 if is_down: logger.warning( From 87489c8e55d759b6f4e992e1c52240d7bfe9ef6d Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 6 Jun 2025 10:54:25 -0700 Subject: [PATCH 2/6] fix api health --- app/utils/api_health.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/utils/api_health.py b/app/utils/api_health.py index 989eb9452..5abd649bf 100644 --- a/app/utils/api_health.py +++ b/app/utils/api_health.py @@ -10,7 +10,7 @@ logger = logging.getLogger(__name__) def get_no_x509_strict_context(): context = ssl.create_default_context() - context.options |= ssl.OP_NO_X509_STRICT + context.verify_flags &= ~ssl.VERIFY_X509_STRICT return context From c5613954a03df74d47da7f7ffd6abdc3ec455196 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 6 Jun 2025 11:03:43 -0700 Subject: [PATCH 3/6] fix api health --- app/utils/api_health.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/utils/api_health.py b/app/utils/api_health.py index 5abd649bf..10949bbbd 100644 --- a/app/utils/api_health.py +++ b/app/utils/api_health.py @@ -18,7 +18,7 @@ def is_api_down(): api_base_url = os.getenv("API_HOST_NAME") try: response = requests.get( - api_base_url, timeout=2, cert=get_no_x509_strict_context() + api_base_url, timeout=2, verify=get_no_x509_strict_context() ) is_down = response.status_code != 200 if is_down: From 3c63a345c91f77367950d043e55b1ad48d8b20d4 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 6 Jun 2025 11:18:47 -0700 Subject: [PATCH 4/6] fix api health --- app/utils/api_health.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils/api_health.py b/app/utils/api_health.py index 10949bbbd..f9875ed8e 100644 --- a/app/utils/api_health.py +++ b/app/utils/api_health.py @@ -7,7 +7,7 @@ from requests.exceptions import RequestException logger = logging.getLogger(__name__) - +# Is this right and can we use it anywhere? def get_no_x509_strict_context(): context = ssl.create_default_context() context.verify_flags &= ~ssl.VERIFY_X509_STRICT @@ -18,7 +18,7 @@ def is_api_down(): api_base_url = os.getenv("API_HOST_NAME") try: response = requests.get( - api_base_url, timeout=2, verify=get_no_x509_strict_context() + api_base_url, timeout=2, verify=False ) is_down = response.status_code != 200 if is_down: From 9c55f5035c7930aca22503c67ba618c780eb1e22 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 6 Jun 2025 11:22:29 -0700 Subject: [PATCH 5/6] fix api health --- app/utils/api_health.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/utils/api_health.py b/app/utils/api_health.py index f9875ed8e..87ddcc99c 100644 --- a/app/utils/api_health.py +++ b/app/utils/api_health.py @@ -7,6 +7,7 @@ from requests.exceptions import RequestException logger = logging.getLogger(__name__) + # Is this right and can we use it anywhere? def get_no_x509_strict_context(): context = ssl.create_default_context() @@ -17,9 +18,7 @@ def get_no_x509_strict_context(): def is_api_down(): api_base_url = os.getenv("API_HOST_NAME") try: - response = requests.get( - api_base_url, timeout=2, verify=False - ) + response = requests.get(api_base_url, timeout=2, verify=False) is_down = response.status_code != 200 if is_down: logger.warning( From a9ff570a53da266cdee9b945bce875e3f0bcfb23 Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Fri, 6 Jun 2025 11:29:37 -0700 Subject: [PATCH 6/6] fix api health --- app/utils/api_health.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/utils/api_health.py b/app/utils/api_health.py index 87ddcc99c..d53b72f9a 100644 --- a/app/utils/api_health.py +++ b/app/utils/api_health.py @@ -18,7 +18,7 @@ def get_no_x509_strict_context(): def is_api_down(): api_base_url = os.getenv("API_HOST_NAME") try: - response = requests.get(api_base_url, timeout=2, verify=False) + response = requests.get(api_base_url, timeout=2, verify=False) # nosec is_down = response.status_code != 200 if is_down: logger.warning(