AutoMl 表 eu-automl api 端点未正确设置? “提供的位置 ID 与端点不匹配”

问题描述

尝试使用 Google Api 客户端发现/构建查找 AutoML Tables 操作 python 的状态。

我可以使用 client_options 'eu-automl.googleapis.com:443' 验证操作(数据导入)是否发生在欧盟地区:

from google.cloud import automl_v1beta1 as automl

client_options = {'api_endpoint': 'eu-automl.googleapis.com:443'}

client = automl.TablesClient(client_options=client_options,project=project_id,region='eu')
# operation response
response = client.import_data(dataset_display_name=dataset_display_name,bigquery_input_uri=bq_uri)

但是在使用以下方法检查操作状态时:

from oauth2client.client import GoogleCredentials
from googleapiclient import discovery

credentials = GoogleCredentials.get_application_default()

service = discovery.build('eu-automl','v1beta1',credentials=credentials)
operation_name = response._operation.name
request = service.projects().locations().operations().get(name=operation_name)
print(request.execute())

我收到错误

    <HttpError 400 when requesting
https://automl.googleapis.com/v1beta1/projects/xxxxx/locations/eu/operations/TBL4579294405873106944?alt=json 
returned "List of found errors: 1.Field: name; Message: The provided location ID doesn't match the endpoint. For automl.googleapis.com,the valid location ID is `us-central1`. For eu-automl.googleapis.com,the valid location ID is `eu`.".

如何正确检查“eu-automl.googleapis.com”?设置 discoveryServiceUrl="https://eu-automl.googleapis.com/$discovery/rest?version=v1beta1" 仍然给我同样的错误

我正在使用

python 3.7
google-cloud-automl==2.2.0

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)