Python gspread获取accessNotConfigured - 找不到项目(编号),不能用于API调用

时间:2018-06-19 10:39:48

标签: python-3.x docker google-api gspread

我正在使用python 3和gspread lib来访问云端的Google工作表。

使用相同的凭据和相同的python脚本以相同的方式运行),它可以在我的计算机上运行,​​并且无法在同一台计算机上的docker镜像中运行,相同的凭据。有时它使用virtualenv(相同的python版本),但现在在docker容器中,我无法弄清楚为什么会发生这种情况。相同的凭据json config。

这是我得到的完整错误:

gspread.exceptions.APIError: {
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Project is not found and cannot be used for API calls. If it is recently created, enable Drive API by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project= then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "extendedHelp": "https://console.developers.google.com/apis/api/drive.googleapis.com/overvie    w?project="
   }
  ],
  "code": 403,
  "message": "Project is not found and cannot be used for API calls. If it is recently created, enable Drive API by visiting https://console.developers.google.com/apis/api/drive.googleapis.com/overview?project=then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
 }
}

知道可能出现什么问题吗?

由于

1 个答案:

答案 0 :(得分:0)

我发现这是一个兼容性问题(与所使用的Sheet API的版本有关。

我将gspread版本从3降级到0.6.2,并且可以正常工作。