Closed layday closed 4 months ago
+1 to this. To share the full DeprecationWarning
:
/path/to/lib/python3.12/site-packages/aiohttp_client_cache/response.py:159: 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).
To filter this out with pytest
:
# pyproject.toml
[tool.pytest.ini_options]
filterwarnings = [
'ignore:datetime.datetime.utcnow\(\) is deprecated and scheduled for removal in a future version:DeprecationWarning:aiohttp_client_cache', # SEE: https://github.com/requests-cache/aiohttp-client-cache/issues/237
]
Hi, just a heads-up that
datetime.utcnow
was deprecated in Python 3.12.datetime.utcnow
is used in several places inaiohttp-client-cache
. The Python documentation recommends creating tz-aware datetime objects instead; a semantic equivalent would bedatetime.utc(timezone.utc).replace(tzinfo=None)
, if you'd like to keep working with "naive" datetimes instead.