Trying to use ssl.PROTOCOL_TLSv1_2
to make TLS1.2 HTTPS requests using Python 2.X.
It was suggested in this thread (Sending TLS 1.2 request in Python 2.6) that I need to switch from Python 2.7.6 to 2.7.10, which I did, and then utilize the ssl
library.
Unfortunately, after switching to Python 2.7.10, I was unable to access ssl.PROTOCOL_TLSv1_2
(apparently I can't post images).
I'm fairly sure I'm using Python 2.7.10 because when I activate my virtual environment and call Python from the command line I see:
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.
I thought maybe that the issue was that the ssl
library was out of date, and this is what I saw when I tried to 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.
Faced the same issue. Try replacing with ssl.PROTOCOL_TLSv1.
Also make sure your SSL version is >= 1.0.1 .
It worked for me .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With