From e8e1d7fec512873ec1d58d825437cafc78b8517b Mon Sep 17 00:00:00 2001 From: hugonicodemos Date: Wed, 1 Jun 2016 13:37:10 +0000 Subject: [PATCH] Remove insecure connection warnings This change turns the Python Requests library warning messages hidden when connecting to oneview without HTTPS, with the option allow_insecure_connection as True. Change-Id: I1c5790d93fd490114211a7245f84793d027c045a --- oneview_client/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oneview_client/client.py b/oneview_client/client.py index f326457..9e1d47b 100644 --- a/oneview_client/client.py +++ b/oneview_client/client.py @@ -26,7 +26,6 @@ from oneview_client import ilo_utils from oneview_client import managers from oneview_client import states - SUPPORTED_ONEVIEW_VERSION = 200 WAIT_DO_REQUEST_IN_MILLISECONDS = 1000 @@ -59,6 +58,11 @@ class BaseClient(object): self.tls_cacert_file = tls_cacert_file self.max_polling_attempts = max_polling_attempts + if self.allow_insecure_connections: + requests.packages.urllib3.disable_warnings( + requests.packages.urllib3.exceptions.InsecureRequestWarning + ) + self.session_id = self.get_session() def verify_credentials(self):