From 86e303b5dae470a50f72dba3b421db5dced4d69c Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Tue, 21 May 2019 09:09:03 +0300 Subject: [PATCH] Suppress InsecureRequestWarning warnings Change-Id: Iac6111ff6f0c5fd048e0793a7dcc1375ed4fa483 --- vmware_nsxlib/v3/cluster.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vmware_nsxlib/v3/cluster.py b/vmware_nsxlib/v3/cluster.py index 573715a7..aad190aa 100644 --- a/vmware_nsxlib/v3/cluster.py +++ b/vmware_nsxlib/v3/cluster.py @@ -34,6 +34,7 @@ from requests import exceptions as requests_exceptions import six import six.moves.urllib.parse as urlparse import tenacity +import urllib3 from vmware_nsxlib._i18n import _ from vmware_nsxlib.v3 import client as nsx_client @@ -45,7 +46,10 @@ LOG = log.getLogger(__name__) # disable warning message for each HTTP retry logging.getLogger( - "requests.packages.urllib3.connectionpool").setLevel(logging.ERROR) + "urllib3.connectionpool").setLevel(logging.ERROR) + +# Hide the InsecureRequestWarning from urllib3 +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) @six.add_metaclass(abc.ABCMeta)