scrapinghub/python-scrapinghub

Deprecation Warning in serialization.py

Closed this issue · 0 comments

The following line of code is triggering a deprecation warning:

EPOCH = datetime.utcfromtimestamp(0)

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

According to the message, the recommended fix is to use timezone-aware objects with datetime.datetime.fromtimestamp(timestamp, datetime.UTC).