본문 바로가기
카테고리 없음

🥰 python ssl 오류 발생하는 경우

by Knowledge Store In Hyunsoft 2021. 5. 31.

SSLCertVerificationError Traceback (most recent call last)

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in do_open(self, http_class, req, **http_conn_args) 1349 try: -> 1350 h.request(req.get_method(), req.selector, req.data, headers, 1351 encode_chunked=req.has_header('Transfer-encoding'))

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in request(self, method, url, body, headers, encode_chunked) 1254 """Send a complete request to the server.""" -> 1255 self._send_request(method, url, body, headers, encode_chunked) 1256

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in _send_request(self, method, url, body, headers, encode_chunked) 1300 body = _encode(body, 'body') -> 1301 self.endheaders(body, encode_chunked=encode_chunked) 1302

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in endheaders(self, message_body, encode_chunked) 1249 raise CannotSendHeader() -> 1250 self._send_output(message_body, encode_chunked=encode_chunked) 1251

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in _send_output(self, message_body, encode_chunked) 1009 del self._buffer[:] -> 1010 self.send(msg) 1011

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in send(self, data) 949 if self.auto_open: --> 950 self.connect() 951 else:

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in connect(self) 1423 -> 1424 self.sock = self._context.wrap_socket(self.sock, 1425 server_hostname=server_hostname)

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session) 499 # ctx._wrap_socket() --> 500 return self.sslsocket_class._create( 501 sock=sock,

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session) 1039 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets") -> 1040 self.do_handshake() 1041 except (OSError, ValueError):

/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in do_handshake(self, block) 1308 self.settimeout(None) -> 1309 self._sslobj.do_handshake() 1310 finally:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)

 

 

임시로 아래 코드 추가하면 해결됨.

import ssl
ssl._create_default_https_context = ssl._create_unverified_context
728x90

댓글