fix: replace deprecated utcfromtimestamp in google-auth-oauthlib#16732
Conversation
Replaces deprecated `datetime.datetime.utcfromtimestamp()` with `datetime.datetime.fromtimestamp(timestamp, datetime.timezone.utc).replace(tzinfo=None)` in `google-auth-oauthlib`. This ensures that a naive datetime is returned, maintaining backwards compatibility, and addresses issue #15433. Co-authored-by: chalmerlowe <7291104+chalmerlowe@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request updates the credentials_from_session function in helpers.py across the codebase to replace the deprecated datetime.datetime.utcfromtimestamp method. The new implementation uses datetime.datetime.fromtimestamp with datetime.timezone.utc and strips the timezone information to maintain the existing behavior of using naive datetime objects. I have no feedback to provide as there were no review comments.
This PR replaces the usage of the deprecated
datetime.datetime.utcfromtimestampin thegoogle-auth-oauthlibpackage and testdata.Using
datetime.datetime.fromtimestamp(session.token["expires_at"], datetime.timezone.utc).replace(tzinfo=None)avoids the deprecation warning in Python 3.12 while preserving backwards compatibility by returning a naive datetime object.Fixes #15433
PR created automatically by Jules for task 232508796818525143 started by @chalmerlowe