環境
- Windows10
- Python3.3
状況
Pythonのgspreadモジュールをアップデートした後に、スクリプトを実行したらこんなエラーが出ました。
Traceback (most recent call last):
File "...\python33\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "...\python33\lib\site-packages\urllib3\connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "...\python33\lib\site-packages\urllib3\connectionpool.py", line 844, in _validate_conn
conn.connect()
File "...\python33\lib\site-packages\urllib3\connection.py", line 326, in connect
ssl_context=context)
File "...\python33\lib\site-packages\urllib3\util\ssl_.py", line 325, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "...\python33\lib\ssl.py", line 210, in wrap_socket
_context=self)
File "...\python33\lib\ssl.py", line 310, in __init__
raise x
File "...\python33\lib\ssl.py", line 306, in __init__
self.do_handshake()
File "...\python33\lib\ssl.py", line 513, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:547)
CERTIFICATE_VERIFY_FAILED
ですよと。ハンドシェイクしたときにSSLの認証でエラーのようです。Windows Updateしてるんですがねぇ。Pythonのバージョンが低いせいかもしれませんが、
諸事情により上げられないので以下の方法で逃げました。
CERTIFICATE_VERIFY_FAILED
でググると結構情報出てきます。
対応
対応方法は以下。
pip3 uninstall -y certifi
pip3 install certifi==2015.04.28
certifiというモジュールを少し古いバージョンに戻しただけです。あまり褒められたやりかたではありませんが、エラーは起きなくなりました。
以上です。