googleapi(gmail和电子表格):我还应该设置什么,或者知道我缺少什么设置?

2024-10-06 10:28:51 发布

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

我正在创建一个webapp,其中包括一些cron作业,称为gmailapi和google电子表格API。在

我已经在我的google开发者死亡公告板上创建了一个项目,并为其提供了证书,以便与我的应用程序一起使用。在

我还启用了控制台中的Gmail API和{}。在

我使用的是Python库,调用这两个api都失败了。在

例如,电子表格服务抛出以下错误:

/home/vardelean/work/connect-app/ty/connect/commands/populate_matching_spreadsheet.pyc in iterate_google_spreadsheet(document_id, spreadsheet_service)
    300         unmatched_hotels_document = spreadsheet_service.values().get(
    301                         spreadsheetId=document_id,
--> 302                         range='Sheet1'
    303         ).execute()["values"]
    304                 header = unmatched_hotels_document[0]

/home/vardelean/ve/connect/local/lib/python2.7/site-packages/oauth2client/util.pyc in positional_wrapper(*args, **kwargs)
    135                 elif positional_parameters_enforcement == POSITIONAL_WARNING:
    136                     logger.warning(message)
--> 137             return wrapped(*args, **kwargs)
    138         return positional_wrapper
    139 

/home/vardelean/ve/connect/local/lib/python2.7/site-packages/googleapiclient/http.pyc in execute(self, http, num_retries)
    830       callback(resp)
    831     if resp.status >= 300:
--> 832       raise HttpError(resp, content, uri=self.uri)
    833     return self.postproc(resp, content)
    834 

HttpError: <HttpError 403 when requesting https://sheets.googleapis.com/v4/spreadsheets/...document id here...../values/Sheet1?alt=json returned "The caller does not have permission">

我不知道没有权限是什么意思。我试图在以该用户身份登录时访问该文件,但我确实拥有对该文件的编辑权限。如前所述,我还启用了Google电子表格API。在

还有Gmail服务这个:

^{2}$

…我不知道“未启用邮件服务”是什么意思,因为我确实在开发控制台中启用了它。在

另外,我检查了一个空的凭证文件会出现什么错误(例如),至少对于gmail服务来说,这是其他一些错误,因此凭证在某种程度上一定是好的。这个错误是RuntimeError: Couldn't authorise with the crentials stored at //path/to/bad/credentials/file

有人能帮忙吗?在


Tags: inapiidhomeconnect错误googledocument
1条回答
网友
1楼 · 发布于 2024-10-06 10:28:51

您可能需要尝试将^{}设置为true,如本文thread中所述,并在SO post中进行了注释。在

正如在给定的reference中提到的:

isMailboxSetup indicates if the user's Google mailbox is created. This property is only applicable if the user has been assigned a Gmail license.

相关问题 更多 >