boto / botocore

The low-level, core functionality of boto3 and the AWS CLI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

botocore using deprecated datetime.datetime.utcnow() call

paulschreiber opened this issue · comments

Describe the bug

botocore is using datetime.datetime.utcnow(), which is deprecated. It generates this warning:

 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).
    datetime_now = datetime.datetime.utcnow()

Expected Behavior

No warnings

Current Behavior

DeprecationWarning

Reproduction Steps

n/a

Possible Solution

Use datetime.datetime.now(datetime.UTC)

Additional Information/Context

No response

SDK version used

1.34.2

Environment details (OS name and version, etc.)

Python 3.12.0

Hi @paulschreiber,

Thanks for reaching out. We're currently tracking this in boto/boto3#3889. Unfortunately, this isn't as straight forward as replacing a function call. We already attempted this in 96ca907 when 3.12 support was released and needed to roll it back due to breaking date serialization changes.

We're currently looking at removing the warnings long term in a backwards compatible manner, but don't have a timeline to provide. The utcnow deprecation is currently slated sometime after Python 3.16, so it's at least few years out. We'll work on getting it addressed more timely.

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.