summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E. Blair <jeblair@linux.vnet.ibm.com>2015-12-16 15:49:59 -0800
committerJames E. Blair <jeblair@linux.vnet.ibm.com>2015-12-16 15:49:59 -0800
commitfb651d406a60c3822165bc8db984380d51d3bec3 (patch)
tree0974df9fdb1d6b6c6ef0e6c97800340dd698bfc8
parentd9eb7114dc483f587f2d67c7de6ceff7f13bae3e (diff)
Add SNIMissingWarning
Notes
Notes (review): Code-Review+2: Jeremy Stanley <fungi@yuggoth.org> Code-Review+1: Clint 'SpamapS' Byrum <clint@fewbar.com> Code-Review+2: Monty Taylor <mordred@inaugust.com> Workflow+1: Monty Taylor <mordred@inaugust.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 04 Jan 2016 23:10:17 +0000 Reviewed-on: https://review.openstack.org/258718 Project: openstack-infra/requestsexceptions Branch: refs/heads/master
-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)