禁止requests请求https的提示InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more

 提示这个 InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see 禁止requests请求https的提示InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more
可以禁止提示。
 
方法一:
requests.packages.urllib3.disable_warnings()
 
 

方法二:

import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

方法三

import warnings
warnings.filterwarnings("ignore")

方法四:

import urllib3

warnings.simplefilter('ignore',category=urllib3.exceptions.InsecureRequestWarning)

此方法比上面方法三更细腻,方法三这样做是禁止了所有模块的warning,打击面积有点大。既然是warning,那就最好不要都禁止了。方法四只禁止InsecureRequestWarning

上一篇:java SE 入门之语言与环境(第一篇)


下一篇:推荐!Sublime Text 最佳插件列表