部署使用Google -api- Python -client库作为Google Cloud Function的Pyth



我创建了一个Python脚本,使用google-api-python-client库从我的DFA帐户中提取数据。

我想把这个脚本部署到Google Cloud Scheduler所以我可以每天运行这个脚本。当我部署云功能时,我收到一个错误说:

ModuleNotFoundError: No module named "googleapiclient".

在我将"googleapiclient"添加到requirements.txt并再次部署它之后,我得到了一个新的错误,说它找不到要添加的googleapiclient库。

请问googleapiclient库是否可以安装在Google云平台下?

可以在GCP中安装和使用googleapiclient库. 模块使用googleapiclient当导入Google API Client时在你的python代码中

import googleapiclient

然后在requirements.txt中添加google-api-python-client

# Function dependencies, for example:
# package>=version
google-api-python-client

您可以检查github中使用googleapiclient模块的示例代码和此requirements.txt。

最新更新