Replace deprecated datetime.utcnow() with timezone-aware UTC
All checks were successful
Build And Test / publish (push) Successful in 48s
All checks were successful
Build And Test / publish (push) Successful in 48s
Use datetime.now(timezone.utc) instead of deprecated utcnow(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional
|
||||
|
||||
from imapclient import IMAPClient
|
||||
@@ -275,7 +275,7 @@ class EmailMonitor:
|
||||
) -> tuple[bool, Optional[str]]:
|
||||
"""Send webhook notification for a new email."""
|
||||
payload = EmailNotificationPayload(
|
||||
timestamp=datetime.utcnow(),
|
||||
timestamp=datetime.now(timezone.utc),
|
||||
email_id=email.id,
|
||||
mailbox=mailbox,
|
||||
from_email=email.from_address.email,
|
||||
@@ -353,7 +353,7 @@ class EmailMonitor:
|
||||
subject=email.subject,
|
||||
email_date=email.date,
|
||||
notification_sent=notification_sent,
|
||||
notification_sent_at=datetime.utcnow() if notification_sent else None,
|
||||
notification_sent_at=datetime.now(timezone.utc) if notification_sent else None,
|
||||
)
|
||||
session.add(seen)
|
||||
await session.commit()
|
||||
@@ -375,7 +375,7 @@ class EmailMonitor:
|
||||
seen = result.scalars().first()
|
||||
if seen:
|
||||
seen.notification_sent = success
|
||||
seen.notification_sent_at = datetime.utcnow() if success else None
|
||||
seen.notification_sent_at = datetime.now(timezone.utc) if success else None
|
||||
seen.notification_error = error
|
||||
session.add(seen)
|
||||
await session.commit()
|
||||
|
||||
Reference in New Issue
Block a user