在 python 中,在 Ubuntu 服务器上,我试图获取 requests 库来发出 https 请求,如下所示:

import requests
requests.post("https://example.com")

起初,我得到以下信息:



在遵循此问题中的建议后: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately ,我现在已将警告升级为以下错误:



我该如何解决?

最佳答案

对我来说修复如下:

sudo apt-get purge python-openssl
sudo pip install pyopenssl

关于python - 属性错误 : '_socketobject' object has no attribute 'set_tlsext_host_name' ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31576258/

10-12 16:51
查看更多