尝试从我的Raspberry Pi授权访问Google智能助理API时,出现“SSLError”类型错误,说明证书验证失败。
当我跑步时:
python -m googlesamples.assistant.auth_helpers --client-secrets <path-to-secrets-file>
我得到以下追踪:
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)
我该如何解决这个问题?
答案 0 :(得分:2)
发生这种情况的一个更可能的问题是您的日期和时间错误。如果您的时间/日期有误,请尝试:
首先使用命令date
(see man page)手动更改日期。例如:
sudo date -s "Mon Apr 24 13:30:00 PDT 2017"
如果可行,但您的时间与时间不同步,请查看these instructions以及其他几种解决方案,以确保您的时间正常同步。