python-2.7 - 使用 tools.run_flow() 在 Google Sheets API 教程中引发 SSLHandshake "certificate verify"错误

标签 python-2.7 ssl windows-10 google-sheets-api oauth2client

我几乎一直在关注 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/

相关文章:

html - Django 1.11 中表单呈现的性能不佳

ssl - 用于私有(private)域注册的 SSL 证书的 whois 验证

java - 在Jetty服务器中如何获取需要客户端认证时使用的客户端证书?

windows-store-apps - 用于商店提交的 .appxupload UWP 包不包含 .appxsym 文件

c# - 当计算机从 sleep /休眠模式恢复时如何捕获事件?

具有多个初始化方法的 Python 子类?

python - 尝试将 ip 地址作为字符串插入 mysql 表时出现错误

python - pyinstaller 在程序内找不到文件路径

wcf - Silverlight WCF 身份验证(从 WPF 到 Silverlight 的帮助)

linux - Windows 10 ubuntu linux bash sshpass获取伪终端失败