SSL:尝试使用 Google Assistant SDK 时 CERTIFICATE_VERIFY_FAILED [英] SSL: CERTIFICATE_VERIFY_FAILED when trying to use the Google Assistant SDK
问题描述
尝试授权从我的 Raspberry Pi 访问 Google Assistant API 时,我收到SSLError"类型的错误,指出证书验证失败.
When trying to authorize access to the Google Assistant API from my Raspberry Pi, I get an error of "SSLError" type, stating that the certificate verification has failed.
当我跑步时:
python -m googlesamples.assistant.auth_helpers --client-secrets
我得到以下跟踪:
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pi/env/lib/python3.4/site-packages/googlesamples/assistant/auth_helpers/__main__.py", line 54, in <module>
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/googlesamples/assistant/auth_helpers/__main__.py", line 48, in main
creds = credentials_flow_interactive(client_secrets, scope)
File "/home/pi/env/lib/python3.4/site-packages/googlesamples/assistant/auth_helpers/__init__.py", line 47, in credentials_flow_interactive
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 535, 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 488, in request
resp = self.send(prep, **send_kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests/adapters.py", line 497, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)
我该如何解决这个问题?
How can I fix this?
推荐答案
发生这种情况的一个更可能的问题是您的日期和时间错误.如果您的时间/日期有误,请尝试:
One of the more likely issues for this to happen is your date and time being wrong. If your time/date is wrong, then try:
首先使用命令
date
(参见手册页).例如:
sudo date -s "Mon Apr 24 13:30:00 PDT 2017"
如果可行,但您的时间与时间不同步,请查看 这些说明 提供了多种替代解决方案,以确保您的时间正确同步.
If that works, but your time keeps desynchronizing with time, check out these instructions with several alternative solutions to ensure your time synchronizes properly.
这篇关于SSL:尝试使用 Google Assistant SDK 时 CERTIFICATE_VERIFY_FAILED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!