我非常关注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“证书验证”错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51643154/

10-13 04:24