Add SNIMissingWarning
Change-Id: I29ec079326f09c6b7e40f2ea4e1afc6ca470ffed
This commit is contained in:
parent
d9eb7114dc
commit
fb651d406a
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user