From 397704daf8e995a2cc8893a3855258cdd1cff461 Mon Sep 17 00:00:00 2001 From: David Lougheed Date: Thu, 11 Apr 2024 12:06:51 -0400 Subject: [PATCH] fix(responses): remove deprecated use of utcnow --- bento_lib/responses/errors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bento_lib/responses/errors.py b/bento_lib/responses/errors.py index 93b3663..e66dda5 100644 --- a/bento_lib/responses/errors.py +++ b/bento_lib/responses/errors.py @@ -1,4 +1,4 @@ -import datetime +from datetime import datetime, timezone from functools import partial from werkzeug.http import HTTP_STATUS_CODES @@ -58,7 +58,7 @@ def http_error( return { "code": code, "message": message, - "timestamp": datetime.datetime.utcnow().isoformat("T") + "Z", + "timestamp": datetime.now(timezone.utc).isoformat("T").split("+")[0] + "Z", **({"errors": [_error_message(e) for e in errors]} if errors else {}), # The DRS spec has a slightly different error specification - if a