Python 2.7 SSLHandshakeError证书验证失败
我正在尝试使用gspread和python从windows桌面写入电子表格。下面的代码可以在我的mac笔记本电脑上运行,但在pc上运行时,会出现sslhandshake错误。我已经确保必要的文件可供程序使用,并尝试创建新项目,但运气不佳,我总是遇到同样的错误 代码如下:Python 2.7 SSLHandshakeError证书验证失败,python-2.7,google-sheets,ssl-certificate,verify,gspread,Python 2.7,Google Sheets,Ssl Certificate,Verify,Gspread,我正在尝试使用gspread和python从windows桌面写入电子表格。下面的代码可以在我的mac笔记本电脑上运行,但在pc上运行时,会出现sslhandshake错误。我已经确保必要的文件可供程序使用,并尝试创建新项目,但运气不佳,我总是遇到同样的错误 代码如下: #databaseTest.py import sys import os import pyodbc import json, gspread from oauth2client.client import SignedJwt
#databaseTest.py
import sys
import os
import pyodbc
import json, gspread
from oauth2client.client import SignedJwtAssertionCredentials
json_key = json.load(open('H:\MyProject-ee653db0fe92.json'))
scope = ['https://spreadsheets.google.com/feeds', 'https://docs.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)
print "Authorizing..."
try:
gc = gspread.authorize(credentials)
input("Done")
except:
print "SSL error"
input("Something went wrong")
gspread.authorize(credentials)
下面是我得到的错误的最后一部分:
File "C:\Python27\lib\site-packages\httplib2\__init__.py", line 1059, in connect
raise SSLHandshakeError(e)
httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
事实证明,从桌面连接到电子表格的问题是由它所连接的网络引起的。笔记本电脑连接到另一个网络,允许它与电子表格通信,但桌面电脑的网络有许多防火墙和安全措施来防止这种情况。事实证明,从桌面连接到电子表格的问题是由它连接到的网络引起的。笔记本电脑连接到另一个网络,允许它与电子表格进行通信,但桌面电脑的网络有许多防火墙和安全措施来防止这种情况。我遇到了同样的问题,调试Google Lib时发现原因是我使用的是较旧版本的
httplib2
(0.9.2)。当我更新到最新版本(0.14.0)时,它起作用了
如果您已经安装了最新版本,请确保某些库没有在其依赖项中安装较旧版本的
httplib2
。我遇到了相同的问题,在调试Google库时,我发现原因是我使用的是较旧版本的httplib2
(0.9.2)。当我更新到最新版本时(0.14.0)它起作用了
如果已经安装了最新版本,请确保某些库没有在其依赖项中安装较旧版本的httplib2