概要
paramiko を import する際に warning が出るのでてっとり早く対応する方法を紹介します
環境
- Ubuntu 24.04.1
- Python 3.10.2
- paramiko 2.12.0
対応前
python
Python 3.10.2 (main, Feb 16 2024, 16:09:49) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import paramiko
/add_disk1/.local/share/virtualenvs/api-UwQw2i9A/lib/python3.10/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
"cipher": algorithms.TripleDES,
/add_disk1/.local/share/virtualenvs/api-UwQw2i9A/lib/python3.10/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
"class": algorithms.TripleDES,
対応後
python
Python 3.10.2 (main, Feb 16 2024, 16:09:49) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> from cryptography.utils import CryptographyDeprecationWarning
>>> warnings.simplefilter('ignore', CryptographyDeprecationWarning)
>>> import paramiko
最後に
warnings の使い方は 3.10 版になります
3.11 系からは少し違うので注意してください