File “/Library/Frameworks/ Versions/3.6/lib/python3.6/urllib/request.py” on line 1318, do_open
encode_chunked = req.has_header(transmit encoded))
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py” on line 1239 in request
self. _send_request(method, url, body, title, encode_chunked)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py” on line 1285 in _send_request
ego. endheaders(body,encode_chunked = encode_chunked)
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/http/client.py” on line 1234 in endheaders
self. _send_output (message_body encode_chunked = encode_chunked)
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/http/client.py” on line 1026 in _send_output
self.send(MSG)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py” on line 964 in send
self.connect ()
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/http/client.py” on line 1400, in connect
server_hostname = server_hostname)
File “/Library/Frameworks/ Versions/3.6/lib/python3.6/ssl.py”, line 407, in wrap_socket
_context = self,_session = session)
File “/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py” on line 814 in rest of init__
self.do_handshake ()
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/ssl.py” on line 1068 in do_handshake
self._sslobj.do_handshake ()
File “/Library/Frameworks/ pythonframework /Versions/3.6/lib/python3.6/ssl.py” on line 689 in do_handshake
self._sslobj.do_handshake ()
ssl. certificate validation failure (_ssl.c:833)
python2.7 upgrade to python3 requires ssl checksumming
So you need to introduce the module ssl
Imported ssl
In the urlopen
Context adds ssl._create_unverified_context ()
Just close the ssl check.
url = “https://www.baidu.com” context = ssl._create_unverified_context()get = urllib.request. urlopen(url, context = context).read()
print
However, this approach is not recommended, as it is better not to close the authentication
> from urllib import request
>>> url = 'https://www.baidu.com'
>>> with request.urlopen(url) as f:
... data = f.read()
... print(f.status)
This may not work
Unverify global
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
Then use urllib.urlopen(‘ URL ‘)
Read More:
- PIP Install Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)’))
- There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590)-skipping
- _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
- Python Error: certificate verify failed: certificate has expired
- python minio client Error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certific
- [Solved] selenium Error: ERROR:ssl_client_socket_impl.cc(962)] handshake failed; returned -1, SSL
- [Solved] pip install Error: There was a problem confirming the ssl certificate…
- SSL error of urllib3 when Python uploads files using Minio
- [Solved] Linux OS python Script Error: smtplib has no attribute SMTP_SSL
- [Solved] ssl_client_socket_impl.cc handshake failed (Same Codes in Different Environments)
- Pycharm WebSocket Error: Error: Connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
- [Solved] PyQt: RuntimeError: wrapped C/C++ object has been deleted & has no attribute of flush in python
- Invalid python sd, Fatal Python error: init_fs_encoding: failed to get the Python cod [How to Solve]
- Xadmin Install Error: Command “python setup.py egg_info“ failed with error code 1 in C:\Users\ADMINI~1\AppDat
- [Solved] opencv-python: recipe for target ‘modules/python3/CMakeFiles/opencv_python3.dir/all‘ failed
- Python Error: pip install mysql-connector-python failed
- Python 3 urllib has no URLEncode attribute
- Chromdriver Install error: File “C:\python37\lib\site-packages\selenium\webdriver\common\service.py”, line 76, in start stdin=PIPE) File…
- [Solved] NPM install Error: check python checking for Python executable python2 in the PATH