首页 > 解决方案 > Python:SSL 证书失败

问题描述

这是我的代码:

import gspread
from oauth2client.service_account import ServiceAccountCredentials

scope =['https://spreadsheets.google.com/feeds','https://www.googleapis.com/auth/drive']    
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)    
client = gspread.authorize(creds)

sheet = client.open("Test)").sheet1

list_of_hashes = sheet.get_all_records()
print(list_of_hashes)

这是结果:

raise SSLError(e, request=request)
requests.exceptions.SSLError:
    HTTPSConnectionPool(host='sheets.googleapis.com', port=443):
    Max retries exceeded with url: /v4/spreadsheets/1AXzSsuOZfZpHDv4jgYCgNbpooxhhYpx8HG6Ue3zq88M?includeGridData=false
   (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines',
                                                        'ssl3_get_server_certificate',
                                                        'certificate verify failed')],)",),))

标签: python-3.xapisslssl-certificate

解决方案


推荐阅读