Skip to content

Commit e4fa015

Browse files
committed
Fix deprecated datetime.utcnow() warning in Python error response
Replace datetime.utcnow() with datetime.now(timezone.utc) to fix deprecation warning in Python 3.12+.
1 parent c55c852 commit e4fa015

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mflix/server/python-fastapi/src/utils/errorResponse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
that match the Express backend's error format.
66
"""
77

8-
from datetime import datetime
8+
from datetime import datetime, timezone
99
from typing import Optional, Any
1010

1111

@@ -33,6 +33,6 @@ def create_error_response(
3333
"code": code,
3434
"details": details
3535
},
36-
"timestamp": datetime.utcnow().isoformat() + "Z"
36+
"timestamp": datetime.now(timezone.utc).isoformat().replace('+00:00', 'Z')
3737
}
3838

0 commit comments

Comments
 (0)