python-jose icon indicating copy to clipboard operation
python-jose copied to clipboard

Resolve deprecation warnings related to datetime.utcnow in python 3.12

Open brouberol opened this issue 2 years ago • 7 comments
trafficstars

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 avatar Nov 01 '23 15:11 brouberol

Thanks @Jamim! Good call indeed

brouberol avatar Dec 27 '23 12:12 brouberol

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

phifuh avatar Jan 22 '24 10:01 phifuh

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.

  • #332
  • #340

Best regards!

Jamim avatar Jan 22 '24 19:01 Jamim

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

phifuh avatar Jan 23 '24 08:01 phifuh

@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.

spapanik avatar Feb 02 '24 16:02 spapanik

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

lsmith77 avatar Feb 02 '24 17:02 lsmith77