The SSL library in Python 2.7.10 does not contain PROTOCOL_TLSv1_2 and updates the results of the SSL library

Trying to use ssl.PROTOCOL_TLSv1_2 to create TLS1.2 HTTPS requests using Python 2.X.

This topic suggested ( Sending a 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 use the ssl library.

Unfortunately, after switching to Python 2.7.10, I was unable to access ssl.PROTOCOL_TLSv1_2 (apparently, I cannot send images).

I am sure that I am 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 the problem is that the ssl library is deprecated and that is what I saw when I tried 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.

+6
source share
2 answers

I used python2.7.10. I changed my env to python2.7.13 which uses the latest ssl version which solved the problem. Thanks.

+1
source

Faced the same problem. Try replacing ssl.PROTOCOL_TLSv1.

Also make sure your SSL version is> = 1.0.1.

It worked for me.

0
source

All Articles