Replace deprecated call to `datetime.utcfromtimestamp`
Proposal:
Starting with Python 3.12 datetime.utcfromtimestamp will be deprecated in favor of the timezone aware datetime.fromtimestamp. https://docs.python.org/3.12/library/datetime.html#datetime.datetime.utcfromtimestamp
AFAICT this only effects one instance in the active (excluding examples) code base and the fix should be pretty simple
https://github.com/influxdata/influxdb-client-python/blob/1ec64b7e1039c891ac3a667ee6697731c61ddbaf/influxdb_client/client/write/point.py#L13
- EPOCH = datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)
+ EPOCH = datetime.fromtimestamp(0, tz=timezone.utc)
Note: datetime.utcnow() will also be deprecated in favor of datetime.now(tz=timezone.utc) but that's only used in examples or tests. https://docs.python.org/3.12/library/datetime.html#datetime.datetime.utcnow
Hi @cdce8p,
thanks for using our client.
Is this something you would be willing to help with? All PR is welcome and we will be happy to review your submission.
Regards
Hi @bednar, Thanks for the reply! Usually I would be happy to open a PR for it. Please understand though, that I'm not willing to sign a CLA just for a one line change. Feel free to use my suggestion from above to contribute it yourself, though.