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

Python 3.12 deprecated usage of datetime.utcnow() #88

Open
igoras1993 opened this issue Jul 15, 2024 · 2 comments
Open

Python 3.12 deprecated usage of datetime.utcnow() #88

igoras1993 opened this issue Jul 15, 2024 · 2 comments

Comments

@igoras1993
Copy link

igoras1993 commented Jul 15, 2024

Describe the bug
Python 3.12 deprecated usage of datetime.utcnow():

datetime: datetime.datetime’s utcnow() and utcfromtimestamp() are deprecated and will be removed in a future version. Instead, use timezone-aware objects to represent datetimes in UTC: respectively, call now() and fromtimestamp() with the tz parameter set to datetime.UTC. (Contributed by Paul Ganssle in gh-103857.)

It may be a good idea to use tz-aware datetimes now.

To Reproduce
E.g. run AsyncFirebaseClient.build_apns_config(...)

.venv/lib/python3.12/site-packages/async_firebase/client.py:232: 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).
    "apns-expiration": str(int(datetime.utcnow().timestamp()) + ttl),

Expected behavior
No warnings are logged.

Desktop:

  • OS: Ubuntu 22
  • Browser Not relevant
  • Package Version: 3.8.0

Smartphone:

  • Not relevant
@igoras1993
Copy link
Author

Me / my colleagues can help and submit a PR in near future :)

@akalex
Copy link
Member

akalex commented Oct 30, 2024

Hi @igoras1993,
Feel free to open PR with changes to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants