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

周雷蒙德

我创建了一个 Python 脚本,它使用 google-api-python-client 库 ( https://github.com/googleapis/google-api-python-client ) 从我的 DFA 帐户中提取数据。

我想将此脚本部署到 Google Cloud Scheduler,以便我可以每天运行此脚本。当我部署该功能时,我收到一条错误消息“ModuleNotFoundError:没有名为“googleapiclient”的模块。

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

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

达尔文

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

import googleapiclient

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

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

您可以使用该模块和此requirements.txt的示例代码中查看此示例代码githubgoogleapiclient

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Google Cloud Function + Python

将 Google Calendar API 与 Python 3.7 Google Cloud Function 结合使用

如何使用python脚本提取多部分zip文件以在Google Cloud Function中运行

如何安装python库-google-api-python-client-gae?

使用Google Cloud Scheduler和python脚本进行系统调用

始终在Google Cloud上运行Python脚本

使用Python脚本中的Google Cloud Functions从Google Cloud Storage中读取CSV

从Cloud Function(Python)写入Google Cloud Storage

简单的 Google Cloud 部署:将 Python 文件从 Google Cloud 存储库复制到应用引擎

使用服务帐户从python从python调用Google Cloud Function

用于通过REST API在Google Cloud Platform中的Cloud Armor中更新规则的Python脚本

Google Cloud SDK与Google Cloud Client库

使用google-api-python-client使用Python访问Google Photo API

从python脚本使用Google Contacts API的简单方法

有没有办法从功能之外的已部署Google Cloud Function导入python帮助器库?

使用 Python 3 使用 Google Cloud Function 重命名对象

使用Google-api-python-client拉超时

在Firebase托管中使用Python Google Cloud Function

使用Python从Google Cloud Stackdriver API检索日志名称列表

如何使用Google Cloud Scheduler Python API创建工作

如何使用Google Cloud Python API将目录复制到Google Cloud Storage?

Google Drive API Client (Python):检索权限

Google Cloud Compute Python API不接受我的启动脚本

如何使用Google Cloud函数安排可与python 3.6一起使用的python脚本?

从本地Python函数到Google Cloud Function

Python代码中的Google Cloud Datastore API

Python:Google Cloud Identity API > 设备 > 列表

Google Cloud Function部署失败

使用源代码库从命令行重新部署 Google Cloud Function