我开始为终端和 python 使用机器学习引擎 API,我发现 bash API 和 python API 之间存在一些差异:
$ gcloud ml-engine jobs list --filter='jobId:eval_*'
JOB_ID STATUS CREATED
eval_chest_frontal_golden_201903 SUCCEEDED 2019-03-12T14:35:50
... (30 other results)
在python中:
from oauth2client.client import GoogleCredentials
from googleapiclient import discovery
from googleapiclient import errors
ml = discovery.build('ml', 'v1')
request = ml.projects().jobs().list(
parent="<<<PROJECT_NAME_HERE>>>",
filter="jobId:eval_*")
response = None
try:
response = request.execute()
except errors.HttpError as err:
raise Exception("Request failed!")
print(response)
# Prints: {}
我查看了具有相同参数的 API 资源管理器:
https://developers.google.com/apis-explorer/#p/ml/v1/ml.projects.jobs.list
我得到与 python 中相同的结果:{}
但看起来 URL 没有转义*
in https://.../jobs?filter=jobId%3Aeval_*&key=...
。也许这就是错误。有什么办法可以在 python API 中解决这个问题?