From cc461fdc3c9e33d1c31ae0f9681f16b0e163cc3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Thu, 12 Dec 2019 23:43:16 +0100 Subject: [PATCH] Disable urllib3 warningns if not ssl_show_warn --- elasticsearch/connection/http_requests.py | 1 - elasticsearch/connection/http_urllib3.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/elasticsearch/connection/http_requests.py b/elasticsearch/connection/http_requests.py index ce079654..f9b6efd2 100644 --- a/elasticsearch/connection/http_requests.py +++ b/elasticsearch/connection/http_requests.py @@ -106,7 +106,6 @@ class RequestsHttpConnection(Connection): if not ssl_show_warn: requests.packages.urllib3.disable_warnings() - self.ssl_show_warn = ssl_show_warn if self.use_ssl and not verify_certs and ssl_show_warn: warnings.warn( "Connecting to %s using SSL with verify_certs=False is insecure." diff --git a/elasticsearch/connection/http_urllib3.py b/elasticsearch/connection/http_urllib3.py index 52755f00..90292852 100644 --- a/elasticsearch/connection/http_urllib3.py +++ b/elasticsearch/connection/http_urllib3.py @@ -196,6 +196,9 @@ class Urllib3HttpConnection(Connection): "Connecting to %s using SSL with verify_certs=False is insecure." % host ) + if not ssl_show_warn: + urllib3.disable_warnings() + self.pool = pool_class( host, port=port, timeout=self.timeout, maxsize=maxsize, **kw