【发布时间】:2015-08-14 00:56:45
【问题描述】:
尝试使用ssl.PROTOCOL_TLSv1_2 使用 Python 2.X 发出 TLS1.2 HTTPS 请求。
在此线程 (Sending TLS 1.2 request in Python 2.6) 中建议我需要从 Python 2.7.6 切换到 2.7.10,我这样做了,然后使用 ssl 库。
很遗憾,在切换到 Python 2.7.10 后,我无法访问ssl.PROTOCOL_TLSv1_2(显然我无法发布图片)。
我很确定我使用的是 Python 2.7.10,因为当我激活我的虚拟环境并从命令行调用 Python 时,我看到:
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
我认为问题可能在于 ssl 库已过时,这就是我在尝试 pip install ssl --upgrade 时看到的内容
Collecting ssl
Using cached ssl-1.16.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/var/folders/xl/nl55_c357zd2gqs09wfwytvh0000gn/T/pip-build-tn97bV/ssl/setup.py", line 12, in <module>
+ "or earlier.")
ValueError: This extension should not be used with Python 2.6 or later (already built in), and has not been tested with Python 2.3.4 or earlier.
【问题讨论】:
标签: python-2.7