我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用requests.packages.urllib3.exceptions.InsecurePlatformWarning()。
def checkenv(self): try: import requests.packages.urllib3 except ImportError: raise Exception('requests package not installed. Run pip install -r requirements.txt and try again.') # Disable warnings about SSL connections try: from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) except ImportError: pass try: from requests.packages.urllib3.exceptions import InsecurePlatformWarning requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) except ImportError: pass
def ignore_warnings(): requests.packages.urllib3.disable_warnings(InsecureRequestWarning) requests.packages.urllib3.disable_warnings(SubjectAltNameWarning) requests.packages.urllib3.disable_warnings(InsecurePlatformWarning) requests.packages.urllib3.disable_warnings(SNIMissingWarning)