작성
·
386
0
p-chapter07-01.py 실행시 아래와 같이 오류가 발생합니다.
SSL 관련 인증 오류 인 것 같은데 어떻게 해야할 지 모르겠습니다.
지금까지 잘 되었는데, 마지막 Chapter에서 오류가 발생하네요.. ㅠ.ㅠ
+ 사용환경
+ OS : MacOS 12.0.1 (Monterey)
+ Python Ver. : 3.10
+ Error Message
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)>
+ Error Log
(p_study) ChangGeuns-MacBook-Pro-15-inch:Python changgeunoh$ /Users/changgeunoh/Desktop/Python/p_study/bin/python /Users/changgeunoh/Desktop/Python/p_study/p_chapter07_01.py
/Users/changgeunoh/Desktop/Python/p_study/p_chapter07_01.py:47: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
/Users/changgeunoh/Desktop/Python/p_study/p_chapter07_01.py:23: DeprecationWarning: getName() is deprecated, get the name attribute instead
print('Thread Name :', threading.current_thread().getName(), 'Start', url)
Thread Name : MainThread Start http://daum.net
Thread Name : MainThread Start https://naver.com
Thread Name : MainThread Start http://mlbpark.donga.com/
Thread Name : MainThread Start https://tistory.com
Thread Name : MainThread Start https://wemakeprice.com/
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1037, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 975, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1454, in connect
self.sock = self._context.wrap_socket(self.sock,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 512, in wrap_socket
return self.sslsocket_class._create(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1070, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1341, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/changgeunoh/Desktop/Python/p_study/p_chapter07_01.py", line 49, in <module>
loop.run_until_complete(main())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 641, in run_until_complete
return future.result()
File "/Users/changgeunoh/Desktop/Python/p_study/p_chapter07_01.py", line 40, in main
rst = await asyncio.gather(*futures)
File "/Users/changgeunoh/Desktop/Python/p_study/p_chapter07_01.py", line 25, in fetch
res = await loop.run_in_executor(executor, urlopen, url)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)>
(p_study) ChangGeuns-MacBook-Pro-15-inch:Python changgeunoh$
답변 1
0
안녕하세요.
다른 url을 사용해보세요!
ssl 오류인데요! 또는 python 버전을 3.7 또는 3.8에서 acyncio 버전을
변경 한 후 실행하시면 정상적으로 동작합니다.
urlopen error [SSL: CERTIFICATE_VERIFY_FAILED