commit: 043cbef7cd6c6fa2ca73fbcdf6769ea21cfb5950 Author: Anna “CyberTailor” <cyber <AT> sysrq <DOT> in> AuthorDate: Thu Feb 1 16:53:50 2024 +0000 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org> CommitDate: Fri Feb 9 17:55:12 2024 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=043cbef7
addons.net: suppress urllib3 import warnings Most notably, this includes NotOpenSSLWarning: https://github.com/urllib3/urllib3/issues/3020#issuecomment-1785873825 Signed-off-by: Anna “CyberTailor” <cyber <AT> sysrq.in> Closes: https://github.com/pkgcore/pkgcheck/pull/661 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org> src/pkgcheck/addons/net.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pkgcheck/addons/net.py b/src/pkgcheck/addons/net.py index 6db5432d..782d74d1 100644 --- a/src/pkgcheck/addons/net.py +++ b/src/pkgcheck/addons/net.py @@ -2,12 +2,14 @@ import logging import os - -import requests +import warnings from ..checks.network import RequestError, SSLError -# suppress all urllib3 log messages +# suppress all urllib3 log messages and import warnings +with warnings.catch_warnings(): + warnings.simplefilter("ignore") + import requests logging.getLogger("urllib3").propagate = False