通过“名称”获得Google VideoIntelligence服务的长时间运行操作

问题描述 投票:0回答:1

如何在python客户端中使用操作名称获取操作对象。

 video_client = videointelligence.VideoIntelligenceServiceClient()
    features = [videointelligence.enums.Feature.TEXT_DETECTION]
    operation = video_client.annotate_video(
        input_uri=input_uri,
        features=features
    )
   # operation.operation.name has the operation name

现在我需要使用该名称来获取操作并查询其状态

 service = discovery.build('cloudresourcemanager', 'v1')
 request = service.operations().get(name=operation.operation.name)

但是我得到了错误:追溯(最近一次通话):文件“”,第1行,位于方法中的文件“ env / local / lib / python2.7 / site-packages / googleapiclient / discovery.py”,第742行(名称,pvalue,正则表达式)TypeError:参数“名称”值“ projects / my-project / locations / us-east1 / operations / 123”与模式“ ^ operations /.*$”]不匹配

所以我尝试了:

service = discovery.build('cloudresourcemanager', 'v1')
request = service.operations().get(name='operations/123')
response = request.execute()

但是它给了我另一个错误:

追踪(最近通话):文件“”,第1行,位于第130行中的文件“ env / local / lib / python2.7 / site-packages / googleapiclient / _helpers.py”,位于positional_wrapper中返回包装(* args,** kwargs)在执行文件“ env / local / lib / python2.7 / site-packages / googleapiclient / http.py”,第842行引发HttpError(resp,content,uri = self.uri)HttpError:https://cloudresourcemanager.googleapis.com/v1/operations/123?alt=json返回“字段[名称]出现问题[无效的操作名称]“>

在python客户端中从名称获取操作对象的正确方法是什么?谢谢。

如何在python客户端中使用操作名称获取操作对象。 video_client = videointelligence.VideoIntelligenceServiceClient()功能= [videointelligence.enums.Feature ....

google-api-python-client video-intelligence-api
1个回答
0
投票

我能够按以下名称获得操作:

© www.soinside.com 2019 - 2024. All rights reserved.