Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated call to datetime.utcfromtimestamp #603

Open
cdce8p opened this issue Aug 20, 2023 · 2 comments · May be fixed by #652
Open

Replace deprecated call to datetime.utcfromtimestamp #603

cdce8p opened this issue Aug 20, 2023 · 2 comments · May be fixed by #652
Assignees
Labels
bug Something isn't working

Comments

@cdce8p
Copy link

cdce8p commented Aug 20, 2023

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

EPOCH = datetime.utcfromtimestamp(0).replace(tzinfo=timezone.utc)

-    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

@bednar
Copy link
Contributor

bednar commented Aug 21, 2023

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

@cdce8p
Copy link
Author

cdce8p commented Aug 21, 2023

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.

@bednar bednar added the bug Something isn't working label Apr 23, 2024
@bednar bednar assigned bednar and unassigned alespour May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants