CryptoUnavailableError:没有可用的加密库(使用google app engine中的oauth2client)

2024-06-28 19:48:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用gspread将我的应用程序连接到电子表格,为此我使用以下代码

import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials

json_key = json.load(open('service_account.json'))
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)
gc = gspread.authorize(credentials)
sheet = gc.open('Order Database').sheet1

当我在idle中使用它来访问电子表格。但是当我在我的应用程序的代码中使用它时,我正在使用googleappengine,当我运行应用程序并尝试访问页面时,我得到了这个错误

^{pr2}$

我甚至成功地在项目目录中安装了库:

pip install -t lib PyOpenSSL
pip install -t lib gspread
pip install -t lib oauth2client
pip install -t lib cryptography 

我甚至试着将--upgrade添加到其中的每一个,并且所有的安装都成功,但是得到了相同的错误

如果我做错了什么,请告诉我,我该如何解决这个问题?在

提前谢谢。在


Tags: installpipkey代码importclientjson应用程序