ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
14.93k stars 2.45k forks source link

Fix: datetime.datetime.utcnow() is deprecated ... #1922

Closed ValueRaider closed 6 months ago

ValueRaider commented 7 months ago

I upgraded Python 3.11 -> 3.12 and get this new 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).

Simple to fix.

ValueRaider commented 7 months ago

~Problem: breaks if Python older than 3.11.~ Solved