From 7de4943100814686f7228a122fbe8ed2b51f8bd3 Mon Sep 17 00:00:00 2001 From: s3lph Date: Sat, 22 Jun 2024 03:06:15 +0200 Subject: [PATCH] chore: replace deprecated datetime.utcnow --- client.py | 2 ++ easywks/types.py | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client.py b/client.py index 32f411f..c8f42eb 100755 --- a/client.py +++ b/client.py @@ -606,6 +606,7 @@ def main(): try: with i: incoming_server = i + break except: continue if incoming_server is None: @@ -615,6 +616,7 @@ def main(): try: with i: outgoing_server = i + break except: continue if outgoing_server is None: diff --git a/easywks/types.py b/easywks/types.py index 6a06825..6b727c7 100644 --- a/easywks/types.py +++ b/easywks/types.py @@ -1,7 +1,7 @@ from typing import List -from datetime import datetime +from datetime import datetime, timezone from email.encoders import encode_noop from email.policy import default from email.utils import format_datetime @@ -107,7 +107,7 @@ class ConfirmationRequest: email['Subject'] = 'Confirm your key publication' email['To'] = self._submitter_addr email['From'] = self._submission_addr - email['Date'] = format_datetime(datetime.utcnow()) + email['Date'] = format_datetime(datetime.now(timezone.utc)) email['Wks-Draft-Version'] = '3' email['Wks-Phase'] = 'confirm' email['X-Loop'] = XLOOP_HEADER @@ -199,7 +199,7 @@ class PublishResponse: email['Subject'] = 'Your key has been published' email['To'] = self.submitter_address email['From'] = self.submission_address - email['Date'] = format_datetime(datetime.utcnow()) + email['Date'] = format_datetime(datetime.now(timezone.utc)) email['Wks-Draft-Version'] = '3' email['Wks-Phase'] = 'done' email['X-Loop'] = XLOOP_HEADER @@ -227,7 +227,7 @@ class EasyWksError(BaseException): email['Subject'] = 'An error has occurred while processing your request' email['From'] = submission_addr email['To'] = submitter_addr - email['Date'] = format_datetime(datetime.utcnow()) + email['Date'] = format_datetime(datetime.now(timezone.utc)) email['Wks-Draft-Version'] = '3' email['Wks-Phase'] = 'error' email['X-Loop'] = XLOOP_HEADER