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

Use timezone-aware datetime objects #926

Merged
merged 1 commit into from
Jul 17, 2024
Merged

Use timezone-aware datetime objects #926

merged 1 commit into from
Jul 17, 2024

Conversation

Tenzer
Copy link
Contributor

@Tenzer Tenzer commented Jul 17, 2024

Rather than using the datetime.utcnow() and datetime.utcfromtimestamp() methods which produce timezone-naive datetime objects, we should instead use datetime.now() and datetime.fromtimestamp() with UTC provided as the timezone, in order to create timezone-aware datetime objects.

This removes the DeprecationWarning that otherwise is raised since Python 3.12 for these methods.

Types of changes

Please check the type of change your PR introduces:

  • Release (new release request)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (PEP8, lint, formatting, renaming, etc)
  • Refactoring (no functional changes, no api changes)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Build related changes (build process, tests runner, etc)
  • Other (please describe):

Checklist

Rather than using the `datetime.utcnow()` and `datetime.utcfromtimestamp()`
methods which produce timezone-naive datetime objects, we should instead use
`datetime.now()` and `datetime.fromtimestamp()` with UTC provided as the
timezone, in order to create timezone-aware datetime objects.

This removes the DeprecationWarning that otherwise is raised since Python 3.12
for these methods.
@nijel nijel merged commit fd7dd90 into python-social-auth:master Jul 17, 2024
7 checks passed
@nijel
Copy link
Member

nijel commented Jul 17, 2024

Merged, thanks for your contribution!

@nijel nijel self-assigned this Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants