Aug 26, 2019

Urllib: disable SSL sertificates check

import ssl
ssl._create_default_https_context = ssl._create_unverified_context
Fix for local environment for example for such exceptions:
Traceback (most recent call last):
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/http/client.py", line 1244, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/http/client.py", line 1290, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/http/client.py", line 1239, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/http/client.py", line 1414, in connect
    server_hostname=server_hostname)
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/home/alexey/anaconda3/envs/torch_04/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)

1 comment:

Unknown said...

As stated by Stanford Medical, It's really the SINGLE reason this country's women live 10 years more and weigh 42 pounds less than us.

(And really, it is not related to genetics or some secret exercise and EVERYTHING to about "how" they eat.)

P.S, I said "HOW", and not "what"...

Click on this link to discover if this easy test can help you discover your true weight loss potential