Python3 requests 라이브러리를 통해 HTTPS 웹페이지와 통신을 하던 도중 아래와 같은 에러를 만났다.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 595, in urlopen
self._prepare_proxy(conn)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 816, in _prepare_proxy
conn.connect()
File "/usr/local/lib/python3.6/site-packages/urllib3/connection.py", line 326, in connect
ssl_context=context)
File "/usr/local/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 329, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
self.do_handshake()
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
ssl ~ 나오는걸로 봐서 아마 SSL관련 오류인 것 같다.
현재 내가 통신하려는 서버는 https를 사용하고 있으므로 옵션을 줘야 한다.
아래와 같이
verify=False 옵션을 주면 해결된다.
83 | From requests documentation on SSL verification:
If you don't want to verify your SSL certificate, make |
참고 : https://stackoverflow.com/questions/10667960/python-requests-throwing-sslerror
'Coding > Python' 카테고리의 다른 글
Django Rest framework 다른 테이블 Join 시키는 방법 (0) | 2018.02.06 |
---|---|
Django 외래키(Foreign key) 생성 방법/관련 이슈 (2) | 2018.02.05 |
장고(Django) Restframework 인증 권한 설정 방법 (0) | 2018.01.10 |
장고(Django) Restframework로 REST API 만드는 방법 (0) | 2018.01.09 |
빗썸(Bithumb) API 사용하는법 (0) | 2018.01.05 |