From da98e340a6be6b6c5fd2d1f834a461a648a9cfe6 Mon Sep 17 00:00:00 2001 From: MrButtCode Date: Mon, 9 Mar 2026 02:19:04 +0500 Subject: [PATCH 1/2] 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 a02956e95d51e282bc025a808b3670ed551fbceb Mon Sep 17 00:00:00 2001 From: MrButtCode Date: Thu, 12 Mar 2026 20:07:48 +0500 Subject: [PATCH 2/2] 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