繁体   English   中英

将使用 google-api-python-client 库的 Python 脚本部署为 Google Cloud Function

[英]Deploying Python script that use google-api-python-client library as Google Cloud Function

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

我想将此脚本部署到Google Cloud Scheduler ,以便我可以每天运行此脚本。 当我部署Cloud Function时,我收到一条错误消息:

“ModuleNotFoundError:没有名为“googleapiclient”的模块。

在将"googleapiclient"添加到requirements.txt并再次部署后,我收到一个新错误,提示找不到要添加的googleapiclient库。

请问可以在谷歌云平台下安装googleapiclient库吗?

是的,可以在GCP中安装和使用googleapiclient库。 在 python 代码中导入Google API 客户端时使用googleapiclient模块

import googleapiclient

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM