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

Remove datetime.datetime.utcnow #3145

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

azliu0
Copy link

@azliu0 azliu0 commented Mar 20, 2024

Resolves #3088, which is currently being tracked in boto/boto3#3889.

It looks like this change was attempted in #3003, but was reverted after #3077 in #3004. These changes differ from #3003 by also addressing the conversion issues brought up in #3077, ensuring that all datetime objects are timezone aware.

These changes further improve on the changes in #3003 by mocking out .now with a factory, rather than hard-coding the return to be the utc value only. This is closer to the actual functionality of .now, which is a function that takes timezone as input (but defaults to utc).

All unit and functional tests pass locally, with the exception of functional/test_resource_leaks.py, which does not pass for me locally before the change.

@adarshraj007
Copy link

Is this issue resolved? We are still getting when we upgrade python to 3.12
DeprecationWarning: datetime.datetime.utcnow() is dep
recated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
datetime_now = datetime.datetime.utcnow()

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