gspread/OAuth2:经过身份验证的默认gmail帐户(在ClientLogin的早期使用) [英] gspread/OAuth2: authenticated default gmail account (used early in ClientLogin)

查看:159
本文介绍了gspread/OAuth2:经过身份验证的默认gmail帐户(在ClientLogin的早期使用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

去年我一直在使用gspread(通过ClientLogin进行身份验证).现在,我想使用OAuth2.我已经按照gspread网站上的教程进行操作: http://gspread.readthedocs.org/en/Latest/oauth2.html

I have been using gspread (authenticated via ClientLogin) for a last year. Now I would like to use OAuth2. I've followed tutorial from gspread site: http://gspread.readthedocs.org/en/latest/oauth2.html

问题在于此方法创建了一个新的电子邮件地址"(在console.developers.google中),该地址无法访问电子表格-所有电子表格都应重新共享.如果您有1000多个电子表格,这确实很难.

The problem is that this method creates new "Email address" (in console.developers.google) which doesn't have an access to spreadsheets - all spreadsheets should be shared again. This is really difficult if you have 1000+ spreadsheets.

问题是:如何通过OAuth2对我的默认gmail帐户(我一直用于通过ClientLogin进行访问)进行身份验证?

The question is: how to authenticated with OAuth2 my default gmail account (that I've been using to access via ClientLogin)?

谢谢!

我已经遵循了本教程: http://www.indjango.com/access-google-sheets-in-python-using-gspread/

I've followed this tutorial: http://www.indjango.com/access-google-sheets-in-python-using-gspread/

但是我从1.2点修改了代码: http://www.indjango.com/access-google-sheets-in-python-using-gspread/#comment-2026863410

But I modified code from point 1.2: http://www.indjango.com/access-google-sheets-in-python-using-gspread/#comment-2026863410

结果-有些电子表格可用,有些则不可用,我也不知道为什么(访问列表中的条目相同)...

Result - some spreadsheets are available, some not and I have no idea why (same entries in access list)...

推荐答案

似乎EDIT中的代码有效.因此,这是可行的解决方案:

It seems that code from EDIT works. Thus, this is working solution:

我已经遵循了本教程: http://www.indjango.com/access-google-sheets-in-python-using-gspread/

I've followed this tutorial: http://www.indjango.com/access-google-sheets-in-python-using-gspread/

但是我从1.2点修改了代码: http://www.indjango.com/access-google-sheets-in-python-using-gspread/#comment-2026863410

But I modified code from point 1.2: http://www.indjango.com/access-google-sheets-in-python-using-gspread/#comment-2026863410

唯一的问题是Google Sheets API仅返回500个结果(因此,如果您在更多不在结果之中的电子表格中使用gspread-> gspread会引发SpreadsheetNotFound).

The only problem is that Google Sheets API returns only 500 results (thus, if using gspread when you have more spreadsheets that are not among results -> gspread raises SpreadsheetNotFound).

这篇关于gspread/OAuth2:经过身份验证的默认gmail帐户(在ClientLogin的早期使用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆