gpt4 book ai didi

python - 属性错误 : '_socketobject' object has no attribute 'set_tlsext_host_name'

转载 作者:太空狗 更新时间:2023-10-29 17:28:40 25 4
gpt4 key购买 nike

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

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

首先,我得到了以下信息:

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: 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 https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

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

AttributeError: '_socketobject' object has no attribute 'set_tlsext_host_name'

我该如何解决这个问题?

最佳答案

我的修复如下:

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com