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 datetime.datetime.utcnow() call with datetime.datetime.now(datetime.UTC) #3089

Closed
wants to merge 1 commit into from

Conversation

paulschreiber
Copy link

Description

Replace deprecated datetime.datetime.utcnow() call with datetime.datetime.now(datetime.UTC).

From the Python 3.12 readme:

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.)

Fixes #3088.

@dlm6693
Copy link
Contributor

dlm6693 commented Dec 26, 2023

Thanks for the PR @paulschreiber! I actually have been working on this myself and just opened #3093 so I'm going to close this one. Also please note that the datetime.UTC syntax was only introduced in python 3.11. Since we still support 3.8 - 3.10, we have to use the old syntax datetime.timezone.utc.

@dlm6693 dlm6693 closed this Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

botocore using deprecated datetime.datetime.utcnow() call
2 participants