【问题标题】:Unable to call discovery.build('compute', 'v1', credentials=credentials) from GCE无法从 GCE 调用 discovery.build('compute', 'v1', credentials=credentials)
【发布时间】:2021-01-23 06:10:58
【问题描述】:

在运行构建命令时它会超时。

from googleapiclient import discovery
from oauth2client.client import GoogleCredentials

credentials = GoogleCredentials.get_application_default()
service = discovery.build('compute', 'v1', credentials=credentials)

我只在正确设置环境的情况下在计算引擎上运行它。这是早些时候工作的。 我可以运行service = discovery.build('storage', 'v1', credentials=credentials) 我现在遇到的错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/googleapiclient/discovery.py", line 250, in build
    developerKey, num_retries=num_retries
  File "/usr/local/lib/python2.7/dist-packages/googleapiclient/discovery.py", line 316, in _retrieve_discovery_doc
    resp, content = req.execute(num_retries=num_retries)
  File "/usr/local/lib/python2.7/dist-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/googleapiclient/http.py", line 901, in execute
    headers=self.headers,
  File "/usr/local/lib/python2.7/dist-packages/googleapiclient/http.py", line 204, in _retry_request
    raise exception
ssl.SSLError: ('The read operation timed out',)

计算引擎 API 有问题吗? 任何线索都会有所帮助。

【问题讨论】:

    标签: python google-cloud-platform google-compute-engine google-api-python-client


    【解决方案1】:

    这是一个已知的临时问题。来自https://status.cloud.google.com/

    Google 的 API Discovery Service GetRest (https://www.googleapis.com/discovery/v1/apis/pubsub/v1/rest) 请求在以下区域挂起:asia-northeast1、asia-northeast2、asia-northeast3、asia-southeast1、europe-west1、europe-west3、europe-west6、europe -west4、northamerica-northeast1、southamerica-east1、us-central1、us-east1、us-west1、us-west2 和 us-west4。

    我们目前正在努力通过回滚配置更改来缓解。下次更新时间为 2020 年 10 月 8 日星期四 07:00 US/Pacific。

    【讨论】:

    • 它也用于计算吗?我看到了 pubsub 链接
    • 我是如何从 us-west2 的 cloudfunction 中找到它的?
    • " us-west1、us-west2 和 " :)
    猜你喜欢
    • 1970-01-01
    • 2019-02-23
    • 2017-07-14
    • 1970-01-01
    • 2016-03-05
    • 2018-09-23
    • 2016-01-21
    • 2017-06-16
    • 1970-01-01
    相关资源
    最近更新 更多