bugsnag / bugsnag-python

Official BugSnag error monitoring and error reporting for django, flask, tornado and other python apps.
https://docs.bugsnag.com/platforms/python/
MIT License
84 stars 42 forks source link

fix: utcnow() warning with python 3.12 #373

Closed Andarius closed 7 months ago

Andarius commented 7 months ago

Fix warning for python 3.12 on utcnow()

Goal

Remove the following deprecation warning:

DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC)

Design

Since datetule.UTC does not exists in previous versions,

Changeset

Replaced utcnow() with dt.datetime.now(timezone.utc).replace(tzinfo=None)

Testing

fabiob commented 4 months ago

Why was this closed? Can I help somehow?