使用gspread和python时如何链接google帐户?

2024-05-23 20:36:55 发布

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

我尝试使用gpread和python来编辑google电子表格。我遵循了这个教程:http://gspread.readthedocs.org/en/latest/oauth2.html 当我运行代码时,它表示没有名为oauth2的模块客户端.client. 我需要安装其他东西才能正常工作吗?在

更新 这是我的代码:

import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials

json_key = json.load(open('GraduationCash-c4b4c0667c75.json'))
scope = ['https://spreadsheets.google.com/feeds']

credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)
gc = gspread.authorize(credentials)

wks = gc.open("Where is the money Lebowski?").sheet1

raw_input()

另外,我应该提到我在Windows8上,所以这些命令不起作用。它仍然在说没有密码库可用


Tags: key代码importclientjson编辑googleopen
1条回答
网友
1楼 · 发布于 2024-05-23 20:36:55

是,必须安装OAuth客户端library

$ pip install  upgrade oauth2client

当然,您总是可以从源代码安装,也可以:

^{pr2}$

注意 在调用后,如果您遇到类似“没有可用的加密库”的错误:

$ apt-get install python-openssl 

或者

$ pip install PyOpenSSL

相关问题 更多 >