'Can't connect to HTTPS URL because the SSL module is not available
when i used the the requets module to get a url's text,there is an Error:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/requests-2.18.1-py3.5.egg/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/local/lib/python3.6/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/connectionpool.py", line 588, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "/usr/local/lib/python3.6/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/connectionpool.py", line 250, in _get_conn
return conn or self._new_conn()
File "/usr/local/lib/python3.6/site-packages/urllib3-1.21.1-py3.5.egg/urllib3/connectionpool.py", line 821, in _new_conn
raise SSLError("Can't connect to HTTPS URL because the SSL "
urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "excuteUpdate.py", line 123, in <module>
downloadList = getapkList(list)
File "excuteUpdate.py", line 35, in getapkList
text = requests.get(detail_path).text
File "/usr/local/lib/python3.6/site-packages/requests-2.18.1-py3.5.egg/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests-2.18.1-py3.5.egg/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests-2.18.1-py3.5.egg/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/site-packages/requests-2.18.1-py3.5.egg/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/site-packages/requests-2.18.1-py3.5.egg/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.
I have installed ssl-1.0.2,and used the command
./configure --with-ssl=/usr/local/ssl
make
make install
but it's not useful;
this is for get a url's text to parse.
the code just like this:
text = requests.get(detail_path).text
Solution 1:[1]
I have solved this question: first,I reinstall the openssl-1.0.2,and use
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/bin/openssl /usr/include/bin/openssl.bak
to remove the old ssl's softlink,then
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/bin/openssl /usr/include/bin/openssl
finally,remake and install the python source code,build the softlink ,this question just be solved.
Solution 2:[2]
Another possible cause of this error (as detailed in this Stack Overflow post) is that you have a file of your own named ssl.py, your script will import this file and cause this same error message to appear.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nimbus |
| Solution 2 | Al Sweigart |
