chore: replace deprecated datetime.utcnow

This commit is contained in:
s3lph 2024-06-22 03:06:15 +02:00
parent dadbcdbf3f
commit 7de4943100
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5
2 changed files with 6 additions and 4 deletions

View file

@ -606,6 +606,7 @@ def main():
try: try:
with i: with i:
incoming_server = i incoming_server = i
break
except: except:
continue continue
if incoming_server is None: if incoming_server is None:
@ -615,6 +616,7 @@ def main():
try: try:
with i: with i:
outgoing_server = i outgoing_server = i
break
except: except:
continue continue
if outgoing_server is None: if outgoing_server is None:

View file

@ -1,7 +1,7 @@
from typing import List from typing import List
from datetime import datetime from datetime import datetime, timezone
from email.encoders import encode_noop from email.encoders import encode_noop
from email.policy import default from email.policy import default
from email.utils import format_datetime from email.utils import format_datetime
@ -107,7 +107,7 @@ class ConfirmationRequest:
email['Subject'] = 'Confirm your key publication' email['Subject'] = 'Confirm your key publication'
email['To'] = self._submitter_addr email['To'] = self._submitter_addr
email['From'] = self._submission_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-Draft-Version'] = '3'
email['Wks-Phase'] = 'confirm' email['Wks-Phase'] = 'confirm'
email['X-Loop'] = XLOOP_HEADER email['X-Loop'] = XLOOP_HEADER
@ -199,7 +199,7 @@ class PublishResponse:
email['Subject'] = 'Your key has been published' email['Subject'] = 'Your key has been published'
email['To'] = self.submitter_address email['To'] = self.submitter_address
email['From'] = self.submission_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-Draft-Version'] = '3'
email['Wks-Phase'] = 'done' email['Wks-Phase'] = 'done'
email['X-Loop'] = XLOOP_HEADER email['X-Loop'] = XLOOP_HEADER
@ -227,7 +227,7 @@ class EasyWksError(BaseException):
email['Subject'] = 'An error has occurred while processing your request' email['Subject'] = 'An error has occurred while processing your request'
email['From'] = submission_addr email['From'] = submission_addr
email['To'] = submitter_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-Draft-Version'] = '3'
email['Wks-Phase'] = 'error' email['Wks-Phase'] = 'error'
email['X-Loop'] = XLOOP_HEADER email['X-Loop'] = XLOOP_HEADER