簡體   English   中英

CryptographyDeprecationWarning:不推薦使用 int_from_bytes,請改用 int.from_bytes

[英]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.

我是 FastAPI 的新手,因為我在我的項目中實現 JWT 令牌,API 正在正常工作,但每次我啟動服務器時都會顯示此警告。

我已經從 jose 導入 jwt,從 passlib.context python 3.9 版導入 CryptContext

我真的很想知道這背后的原因是什么!

棄用警告是由python-jose庫如何從字節加載 integer 值引起的。 這與 fastapi 無關,但您正在使用的庫中存在問題。 但是,該問題已在五天前(2021-04-29)在python-jose中修復,並將在下一個版本中出現。

您可以在 Github 上看到提交中的更改 現在你可以忽略警告,但是一旦python-jose的升級版本發布,你應該升級到新版本。

嘗試將密碼學 package 升級到最新的可用版本

python3 -m pip install -U cryptography

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM