SSL:使用Google智能助理SDK进行certificate_verify_failed

时间:2017-06-02 16:03:28

标签: ssl raspberry-pi google-assistant-sdk

我尝试在pi上运行google助手sdk示例但是在使用

接收授权网址后
google-oauthlib-tool --client-secrets /home/pi/client_secret_<my-id>.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless

我从提供的网址输入代码并获取此转储:

Traceback (most recent call last):
  File "/home/pi/env/lib/python3.4/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/home/pi/env/lib/python3.4/site-packages/urllib3/connectionpool.py", line 345, in _make_request
    self._validate_conn(conn)
  File "/home/pi/env/lib/python3.4/site-packages/urllib3/connectionpool.py", line 844, in _validate_conn
    conn.connect()
  File "/home/pi/env/lib/python3.4/site-packages/urllib3/connection.py", line 326, in connect
    ssl_context=context)
  File "/home/pi/env/lib/python3.4/site-packages/urllib3/util/ssl_.py", line 325, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/usr/lib/python3.4/ssl.py", line 364, in wrap_socket
    _context=self)
  File "/usr/lib/python3.4/ssl.py", line 577, in __init__
    self.do_handshake()
  File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/env/lib/python3.4/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/home/pi/env/lib/python3.4/site-packages/urllib3/connectionpool.py", line 630, in urlopen
    raise SSLError(e)
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/env/bin/google-oauthlib-tool", line 11, in <module>
    sys.exit(main())
  File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/env/lib/python3.4/site-packages/google_auth_oauthlib/tool/__main__.py", line 106, in main
    creds = flow.run_console()
  File "/home/pi/env/lib/python3.4/site-packages/google_auth_oauthlib/flow.py", line 358, in run_console
    self.fetch_token(code=code)
  File "/home/pi/env/lib/python3.4/site-packages/google_auth_oauthlib/flow.py", line 235, in fetch_token
    **kwargs)
  File "/home/pi/env/lib/python3.4/site-packages/requests_oauthlib/oauth2_session.py", line 221, in fetch_token
    verify=verify, proxies=proxies)
  File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 560, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/home/pi/env/lib/python3.4/site-packages/requests_oauthlib/oauth2_session.py", line 360, in request
    headers=headers, data=data, **kwargs)
  File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 513, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 623, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/env/lib/python3.4/site-packages/requests/adapters.py", line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

我检查了this post有类似问题并相应地更新了我的时钟,但这似乎不是问题所在。我已经重新下载了所有的库和工具,并确保python是最新的,但我不能让它工作。这个问题有什么解决方案吗?

值得注意的是,无论我作为授权代码放入什么内容,都会出现同样的痕迹,即使只是放入&#34; x&#34;产生相同的输出。

1 个答案:

答案 0 :(得分:2)

我按照https://developers.google.com/assistant/sdk/develop/python/run-sample的说明操作,但我认为这些说明忘记了步骤:

sudo apt-get install portaudio19-dev libffi-dev libssl-dev

这样做然后重新运行google-oauthlib-tool。