mpdavis / python-jose

A JOSE implementation in Python
MIT License
1.55k stars 237 forks source link

Resolve deprecation warnings related to datetime.utcnow in python 3.12 #335

Open brouberol opened 1 year ago

brouberol commented 1 year ago

When upgrading my project to python 3.12, I started seeing deprecation warnings related to the use of datetime.datetime.utcnow.

/Users/br/.../lib/python3.12/site-packages/jose/jwt.py:311: 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).
    now = timegm(datetime.utcnow().utctimetuple())

This PR simply implements the suggestion (in a backwards-compatible fashion), to get rid of these warnings in all projects depending on python-jose.

Regards

Fixes #334

brouberol commented 11 months ago

Thanks @Jamim! Good call indeed

phifuh commented 10 months ago

will this be bundled into release 3.4 or just a minor update?

Jamim commented 10 months ago

Hello @phifuh,

will this be bundled into release 3.4 or just a minor update?

Sorry, but it looks like chances of this happening are near zero.

Best regards!

phifuh commented 10 months ago

@Jamim thats fair, eventually someone might fork this project and actively maintain it, at least thats what I hope

spapanik commented 9 months ago

@Jamim @phifuh I agree that there is a slim chance to get this change done, so I'm forking this, and I plan to create a successor for it. But, it seems like a lot of work to maintain multiple different backends, so I will keep cryptography and drop the rest.

lsmith77 commented 9 months ago

guess it makes more sense to migrate to https://github.com/jpadilla/pyjwt