我几乎一直在关注 Google 表格入门(使用 Python)。我已经让程序在我的 Mac 笔记本电脑上运行,但它失败了,因为我试图在 Windows 上运行它。到目前为止,我已经检查过我们没有在机器上启用防火墙。
下面是点击浏览器中弹出的身份验证提示后出现的错误。
Traceback (most recent call last):
File "Authenticate.py", line 47, in <module>
main()
File "Authenticate.py", line 43, in main
tools.run_flow(flow, store)
File "C:\johnsnow\packages\test\lib\site-packages\oauth2client\_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\johnsnow\packages\test\lib\site-packages\oauth2client\tools.py", line 243, in run_flow
credential = flow.step2_exchange(code, http=http)
File "C:\johnsnow\packages\test\lib\site-packages\oauth2client\_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "C:\johnsnow\packages\test\lib\site-packages\oauth2client\client.py", line 2054, in step2_exchange
http, self.token_uri, method='POST', body=body, headers=headers)
File "C:\johnsnow\packages\test\lib\site-packages\oauth2client\transport.py", line 282, in request
connection_type=connection_type)
File "C:\johnsnow\packages\test\lib\site-packages\httplib2\__init__.py", line 1570, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "C:\johnsnow\packages\test\lib\site-packages\httplib2\__init__.py", line 1317, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "C:\johnsnow\packages\test\lib\site-packages\httplib2\__init__.py", line 1252, in _conn_request
conn.connect()
File "C:\johnsnow\packages\test\lib\site-packages\httplib2\__init__.py", line 1044, in connect
raise SSLHandshakeError(e)
httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)
最佳答案
我不太确定这是怎么发生的,因为我在 virtualenv 中工作,但在 httplib2 和 oauth2 的版本中存在依赖性问题。卸载后重新安装,出现两个库不兼容的错误。
执行 pip freeze
显示我有 httplib2==0.8
但 oauth2client 需要 httplib2=>0.9
。
这已通过执行 pip install --upgrade httplib2
解决。
关于python-2.7 - 使用 tools.run_flow() 在 Google Sheets API 教程中引发 SSLHandshake "certificate verify"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51643154/