mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
Confirm support for Django 4.1
Replaces deprecated `django.utils.timezone.utc` with `datetime.timezone.utc` (available since Python 3.2).
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
from django.utils.timezone import utc
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from .base import AnymailBaseWebhookView
|
||||
from ..signals import AnymailTrackingEvent, EventType, RejectReason, tracking
|
||||
@@ -45,7 +43,7 @@ class SendinBlueTrackingWebhookView(AnymailBaseWebhookView):
|
||||
# SendinBlue supplies "ts", "ts_event" and "date" fields, which seem to be based on the
|
||||
# timezone set in the account preferences (and possibly with inconsistent DST adjustment).
|
||||
# "ts_epoch" is the only field that seems to be consistently UTC; it's in milliseconds
|
||||
timestamp = datetime.fromtimestamp(esp_event["ts_epoch"] / 1000.0, tz=utc)
|
||||
timestamp = datetime.fromtimestamp(esp_event["ts_epoch"] / 1000.0, tz=timezone.utc)
|
||||
except (KeyError, ValueError):
|
||||
timestamp = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user