【问题标题】:API for Google Cloud Platform: gcloud API or Google API ClientGoogle Cloud Platform API:gcloud API 或 Google API Client
【发布时间】:2016-12-19 17:31:08
【问题描述】:

我正在使用谷歌云平台。学习并尝试 Bigquery 和 Google Cloud Storage 等一些东西。

我发现所有这些事情都有两个官方 API 令人困惑:gcloud API 和 Google API Python 客户端。在google cloud的“入门”教程中,推荐的API是Google API (Python) Client,而且gcloud api的文档好像不是很详细。

简而言之,以编程方式访问 Google Cloud Platform,

  1. 哪个api库更好?
  2. 我在哪里可以找到很好的文档?

【问题讨论】:

    标签: google-bigquery google-cloud-storage google-api-client gcloud


    【解决方案1】:

    我的回答

    我会推荐gcloud API,这个选择也适用于其他语言:nodejs、ruby....然后

    说明

    令人困惑的是,Google 让这两个 API 具有重叠的功能。更令人困惑的是,他们在教程中使用了 Google API Client,而 gcloud 似乎是一个更具体的 Google Cloud SDK 包。

    这是我发现的:在 gcloud API 页面的页面上,有这个常见问题解答部分说:

    Google APIs Python 客户端是一个客户端库,用于使用广泛的 Google APIs。 gcloud-python 专为 Google Cloud Platform 构建,是推荐的方式将 Google Cloud API 集成到 Python 应用程序中。如果您的应用程序需要 Google Cloud Platform 和其他 Google API,则您的应用程序可能会使用这两个库。

    此外,gcloud api 是 Google Cloud SDK 的一部分。所以它是标准的。

    gcloud 命令行工具和 gcloud-python 软件包都是 Google Cloud SDK 的一部分:一组工具和库可让您在 Google Cloud Platform 上轻松创建和管理资源。 gcloud 命令行工具可用于管理您的开发工作流程和 Google Cloud Platform 资源,而 gcloud-python 包是适用于 Python 的 Google Cloud 客户端库。

    根据我使用 python 和 nodejs api 的经验,gcloud api 比 google api 客户端更容易使用。这里还有一个问题供您参考:

    When accessing Bigquery using Python API, what is the difference of using google client API and gcloud

    显然,对于围绕 Google Cloud Platform 工作的项目,使用 gcloud API 是更好的选择。

    文档

    文档呢? 如果您查看这样的页面,该文档似乎不是很有帮助(尤其是对于像我这样的新手程序员): https://googlecloudplatform.github.io/gcloud-python/#/docs/master/gcloud/storage/blob/blob

    我找到了两种获取更详细说明的方法:查找稳定版本的文档或转到 github 页面。例如:

    1. https://googlecloudplatform.github.io/gcloud-python/stable/storage-blobs.html
    2. https://github.com/GoogleCloudPlatform/gcloud-python

    这是我对它进行的少量研究的结果。我仍然很好奇为什么 Google 在其教程中很少提及 gcloud 库。无论如何,我希望这将有助于人们了解使用哪个库,并节省一些时间研究它。

    【讨论】:

    • 请注意,nodejs gcloud 包最近更名为google-cloud
    猜你喜欢
    • 1970-01-01
    • 2019-02-26
    • 2020-08-22
    • 2021-12-04
    • 2021-05-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多