Browse Source

Add SNIMissingWarning

Change-Id: I29ec079326f09c6b7e40f2ea4e1afc6ca470ffed
tags/1.1.2^2
James E. Blair 3 years ago
parent
commit
fb651d406a
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      requestsexceptions/__init__.py

+ 10
- 0
requestsexceptions/__init__.py View File

@@ -38,11 +38,21 @@ except ImportError:
38 38
     except ImportError:
39 39
         SubjectAltNameWarning = None
40 40
 
41
+try:
42
+    from requests.packages.urllib3.exceptions import SNIMissingWarning
43
+except ImportError:
44
+    try:
45
+        from urllib3.exceptions import SNIMissingWarning
46
+    except ImportError:
47
+        SNIMissingWarning = None
48
+
41 49
 
42 50
 def squelch_warnings(insecure_requests=True):
43 51
     if SubjectAltNameWarning:
44 52
         warnings.filterwarnings('ignore', category=SubjectAltNameWarning)
45 53
     if InsecurePlatformWarning:
46 54
         warnings.filterwarnings('ignore', category=InsecurePlatformWarning)
55
+    if SNIMissingWarning:
56
+        warnings.filterwarnings('ignore', category=SNIMissingWarning)
47 57
     if insecure_requests and InsecureRequestWarning:
48 58
         warnings.filterwarnings('ignore', category=InsecureRequestWarning)

Loading…
Cancel
Save