简体   繁体   中英

CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead

INFO:Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) 
INFO:Started reloader process [27528] using statreload
C:Python\Python39\lib\site-packages\jose\backends\cryptography_backend.py:18:
CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes 
instead from cryptography.utils import int_from_bytes, int_to_bytes 
INFO: Started server process [8912]
INFO: Waiting for application startup. 
INFO: Application startup complete.

I am new to FastAPI as I was implementing the JWT token in my project the APIs are working as it should be, but each time I start the server it shows this warning.

I have imported jwt from jose and CryptContext from passlib.context python version 3.9

I really love to know what is the reason behind this!

The deprecation warning is caused by how the python-jose library loads the integer values from bytes. This is not related to fastapi, but is an issue in the library you're using. However, the issue was fixed in python-jose five days ago (2021-04-29), and will be present in the next release.

You can see the change in the commit on Github. For now you can ignore the warning, but as soon as an upgraded version of python-jose is released you should upgrade to the new version.

Try to upgrade cryptography package to the newest available version

python3 -m pip install -U cryptography

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM