From fb651d406a60c3822165bc8db984380d51d3bec3 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 16 Dec 2015 15:49:59 -0800 Subject: [PATCH] Add SNIMissingWarning Change-Id: I29ec079326f09c6b7e40f2ea4e1afc6ca470ffed --- requestsexceptions/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/requestsexceptions/__init__.py b/requestsexceptions/__init__.py index 6cb585c..c592548 100644 --- a/requestsexceptions/__init__.py +++ b/requestsexceptions/__init__.py @@ -38,11 +38,21 @@ except ImportError: except ImportError: SubjectAltNameWarning = None +try: + from requests.packages.urllib3.exceptions import SNIMissingWarning +except ImportError: + try: + from urllib3.exceptions import SNIMissingWarning + except ImportError: + SNIMissingWarning = None + def squelch_warnings(insecure_requests=True): if SubjectAltNameWarning: warnings.filterwarnings('ignore', category=SubjectAltNameWarning) if InsecurePlatformWarning: warnings.filterwarnings('ignore', category=InsecurePlatformWarning) + if SNIMissingWarning: + warnings.filterwarnings('ignore', category=SNIMissingWarning) if insecure_requests and InsecureRequestWarning: warnings.filterwarnings('ignore', category=InsecureRequestWarning)