summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-01-04 23:10:17 +0000
committerGerrit Code Review <review@openstack.org>2016-01-04 23:10:17 +0000
commitcd9cc9836546f66ab64fc0fe9fb846239ac51df5 (patch)
treeddfa77ad7e363ad86d81b37d1ca1ac41b057d7bb
parentee3e51ffcf89373aced408ca2b887fad7253a3fc (diff)
parentfb651d406a60c3822165bc8db984380d51d3bec3 (diff)
Merge "Add SNIMissingWarning"1.1.2
-rw-r--r--requestsexceptions/__init__.py10
1 files changed, 10 insertions, 0 deletions
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:
38 except ImportError: 38 except ImportError:
39 SubjectAltNameWarning = None 39 SubjectAltNameWarning = None
40 40
41try:
42 from requests.packages.urllib3.exceptions import SNIMissingWarning
43except ImportError:
44 try:
45 from urllib3.exceptions import SNIMissingWarning
46 except ImportError:
47 SNIMissingWarning = None
48
41 49
42def squelch_warnings(insecure_requests=True): 50def squelch_warnings(insecure_requests=True):
43 if SubjectAltNameWarning: 51 if SubjectAltNameWarning:
44 warnings.filterwarnings('ignore', category=SubjectAltNameWarning) 52 warnings.filterwarnings('ignore', category=SubjectAltNameWarning)
45 if InsecurePlatformWarning: 53 if InsecurePlatformWarning:
46 warnings.filterwarnings('ignore', category=InsecurePlatformWarning) 54 warnings.filterwarnings('ignore', category=InsecurePlatformWarning)
55 if SNIMissingWarning:
56 warnings.filterwarnings('ignore', category=SNIMissingWarning)
47 if insecure_requests and InsecureRequestWarning: 57 if insecure_requests and InsecureRequestWarning:
48 warnings.filterwarnings('ignore', category=InsecureRequestWarning) 58 warnings.filterwarnings('ignore', category=InsecureRequestWarning)