Do not call deprecated datetime.utcnow() and datetime.utcfromtimestamp() (#9735)

* Do not call deprecated datetime.utcnow() and datetime.utcfromtimestamp()

* Ignore DeprecationWarnings from importing dependencies

$ python3 -Wdefault
Python 3.12.0b4 (main, Jul 12 2023, 00:00:00) [GCC 13.1.1 20230614 (Red Hat 13.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
/usr/lib/python3.12/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
  warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)
>>> import pytz
/usr/lib/python3.12/site-packages/pytz/tzinfo.py:27: DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC).
  _epoch = datetime.utcfromtimestamp(0)

* Used pytz.UTC consistently for clarity
This commit is contained in:
Mattias Ellert
2023-07-18 15:44:25 -07:00
committed by GitHub
parent c31d3a2cfd
commit 6effedc2f4
12 changed files with 26 additions and 19 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
### Fixed
*
* Do not call deprecated datetime.utcnow() and datetime.utcfromtimestamp()
More details about these changes can be found on our GitHub repo.