首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Google客户端获取用于云函数的Google函数列表?

如何使用Google客户端获取用于云函数的Google函数列表?
EN

Stack Overflow用户
提问于 2021-11-14 16:24:15
回答 1查看 481关注 0票数 2

我想要执行我认为相当简单的任务--使用python,我想在给定的项目中获得Google函数的列表,并想找出正确的库。

我正在努力理解https://github.com/googleapis的无数次回购。我看得出来

然而,在https://github.com/googleapis/google-api-python-client#other-google-api-libraries,有人说:

此存储库的维护人员建议在可能的情况下使用用于Python的云客户机库进行新的代码开发。

然后按照那里的链接引导我到

其中有一个链接到

这似乎是更适合使用的库(pip install google-cloud-functions),因为在https://github.com/googleapis/google-api-python-client#other-google-api-libraries中说明了原因。

我遇到的问题是,似乎有许多示例/示例演示了https://github.com/googleapis/google-api-python-client的使用,但对于https://github.com/googleapis/python-functions的使用则较少。事实上,我的Google已经让我失望了,因为我找不到如何使用https://github.com/googleapis/python-functions来完成我的任务的任何例子(即获得Google函数的列表)。https://googleapis.dev/python/cloudfunctions/latest/index.html的API文档有些帮助,但它似乎缺乏示例代码。例如,我问自己的一个问题是,我是否应该使用

或者甚至是别的什么东西。

有人能解释我如何使用CloudFunctionsServiceClientCloudFunctionsServiceAsyncClient来获取函数列表吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-14 16:25:54

弄明白了。这些工作

代码语言:javascript
复制
from google.cloud.functions_v1.services.cloud_functions_service import CloudFunctionsServiceAsyncClient
from google.cloud.functions_v1.types import ListFunctionsRequest
list_functions_request = ListFunctionsRequest(parent=f"projects/{project}/locations/{region}")
await CloudFunctionsServiceAsyncClient().list_functions(list_functions_request)
代码语言:javascript
复制
from google.cloud.functions_v1.services.cloud_functions_service import CloudFunctionsServiceClient
from google.cloud.functions_v1.types import ListFunctionsRequest
list_functions_request = ListFunctionsRequest(parent=f"projects/{project}/locations/{region}")
await CloudFunctionsServiceClient().list_functions(list_functions_request)
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69964961

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档