From a77974a68162d5e1713d932cf65eca68b969f2af Mon Sep 17 00:00:00 2001 From: MrButtCode Date: Mon, 9 Mar 2026 02:19:04 +0500 Subject: [PATCH 1/4] refactor(health): replace deprecated datetime.utcnow() with timezone-aware datetime --- mod_health/controllers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mod_health/controllers.py b/mod_health/controllers.py index a2801616..ce31cede 100644 --- a/mod_health/controllers.py +++ b/mod_health/controllers.py @@ -2,7 +2,7 @@ import os import subprocess -from datetime import datetime +from datetime import datetime, timezone from typing import Any, Dict, Optional, Tuple from flask import Blueprint, current_app, jsonify @@ -79,7 +79,7 @@ def health_check() -> Tuple[Any, int]: checks: Dict[str, Any] = { 'status': 'healthy' if all_healthy else 'unhealthy', - 'timestamp': datetime.utcnow().isoformat() + 'Z', + 'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat() + 'Z', 'checks': check_results } @@ -99,7 +99,7 @@ def liveness_check() -> Tuple[Any, int]: """ return jsonify({ 'status': 'alive', - 'timestamp': datetime.utcnow().isoformat() + 'Z' + 'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat() + 'Z' }), 200 @@ -172,7 +172,7 @@ def version_check() -> Tuple[Any, int]: git_info = get_git_info() response = { - 'timestamp': datetime.utcnow().isoformat() + 'Z', + 'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat() + 'Z', 'git': git_info, } From f4b62ba4016222e20952ba426918dd210bcf5139 Mon Sep 17 00:00:00 2001 From: MrButtCode Date: Thu, 12 Mar 2026 20:07:48 +0500 Subject: [PATCH 2/4] style: remove trailing whitespace to resolve pycodestyle CI failure --- mod_health/controllers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_health/controllers.py b/mod_health/controllers.py index ce31cede..ed91027f 100644 --- a/mod_health/controllers.py +++ b/mod_health/controllers.py @@ -99,7 +99,7 @@ def liveness_check() -> Tuple[Any, int]: """ return jsonify({ 'status': 'alive', - 'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat() + 'Z' + 'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat() + 'Z' }), 200 From 2a05e863f4bb1eca17e1e15630adf365c581ec87 Mon Sep 17 00:00:00 2001 From: MrButtCode Date: Sun, 15 Mar 2026 20:09:58 +0500 Subject: [PATCH 3/4] refactor(health): simplify timezone aware datetime formatting --- mod_health/controllers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_health/controllers.py b/mod_health/controllers.py index ed91027f..734c98cd 100644 --- a/mod_health/controllers.py +++ b/mod_health/controllers.py @@ -79,7 +79,7 @@ def health_check() -> Tuple[Any, int]: checks: Dict[str, Any] = { 'status': 'healthy' if all_healthy else 'unhealthy', - 'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat() + 'Z', + 'timestamp': datetime.now(timezone.utc).isoformat(), 'checks': check_results } From 076d997913e515882995add17e3dec8fbecee48a Mon Sep 17 00:00:00 2001 From: MrButtCode Date: Tue, 17 Mar 2026 03:36:54 +0500 Subject: [PATCH 4/4] refactor(health): remove remaining timezone stripping hacks --- mod_health/controllers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod_health/controllers.py b/mod_health/controllers.py index 734c98cd..00b46498 100644 --- a/mod_health/controllers.py +++ b/mod_health/controllers.py @@ -99,7 +99,7 @@ def liveness_check() -> Tuple[Any, int]: """ return jsonify({ 'status': 'alive', - 'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat() + 'Z' + 'timestamp': datetime.now(timezone.utc).isoformat() }), 200 @@ -172,7 +172,7 @@ def version_check() -> Tuple[Any, int]: git_info = get_git_info() response = { - 'timestamp': datetime.now(timezone.utc).replace(tzinfo=None).isoformat() + 'Z', + 'timestamp': datetime.now(timezone.utc).isoformat(), 'git': git_info, }