From 77beee1d4ab3611c4b94f283bea00be2b9e16014 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Thu, 13 Oct 2022 09:23:02 +0200 Subject: [PATCH] Mute consequent InsecureRequestWarning warnings --- osc/connection.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osc/connection.py b/osc/connection.py index 3e9f9c80..32216709 100644 --- a/osc/connection.py +++ b/osc/connection.py @@ -8,6 +8,7 @@ import ssl import sys import tempfile import time +import warnings import http.client import http.cookiejar @@ -25,6 +26,10 @@ from . import oscssl from .util.helper import decode_it +# print only the first occurrence of matching warnings, regardless of location +warnings.filterwarnings("once", category=urllib3.exceptions.InsecureRequestWarning) + + class MockRequest: """ Mock a request object for `cookiejar.extract_cookies()`