Google Video Intelligence API查询

时间:2017-03-13 10:46:28

标签: python google-api google-api-client google-api-python-client video-intelligence-api

我正在尝试在我的个人项目中实施VideoIntelligence API。但我无法这样做。 [我拥有个人项目VideoIntelligence API的访问权限]

请提供一些建议,使其发挥作用。

我尝试了以下命令:

(venv) naveen@naveen:~/Desktop/personal-project$ python manage.py shell
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from google.cloud.gapic.videointelligence.v1beta1 import video_intelligence_service_client
>>> video_client = video_intelligence_service_client.VideoIntelligenceServiceClient()
>>> path = 'gs://demomaker/google_gmail.mp4'
>>> features = [2]
>>> operation = video_client.annotate_video(path, features)

但我得到的是错误:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "personal-project/venv/local/lib/python2.7/site-packages/google/cloud/gapic/videointelligence/v1beta1/video_intelligence_service_client.py", line 234, in annotate_video
    self._annotate_video(request, options), self.operations_client,
  File "personal-project/venv/local/lib/python2.7/site-packages/google/gax/api_callable.py", line 419, in inner
    return api_caller(api_call, this_settings, request)
  File "personal-project/venv/local/lib/python2.7/site-packages/google/gax/api_callable.py", line 407, in base_caller
    return api_call(*args)
  File "personal-project/venv/local/lib/python2.7/site-packages/google/gax/api_callable.py", line 368, in inner
    return a_func(*args, **kwargs)
  File "personal-project/venv/local/lib/python2.7/site-packages/google/gax/retry.py", line 126, in inner
    ' classified as transient', exception)
RetryError: GaxError(Exception occurred in retry method that was not classified as transient, caused by <_Rendezvous of RPC that terminated with (StatusCode.PERMISSION_DENIED, Google Cloud Video Intelligence API has not been used in project usable-auth-library before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/videointelligence.googleapis.com/overview?project=usable-auth-library then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.)>)

正在搜索内部可用的auth-library&#39;项目。鉴于它应该搜索/使用我的个人项目&#39;的许可。 [因为我可以访问&#39;个人项目&#39;而不是&#39;可用 - auth-library&#39;]

我该如何使这项工作?有什么建议吗?

由于

2 个答案:

答案 0 :(得分:1)

Google Video Intelligence目前处于私人测试状态。这意味着您需要申请测试版访问才能使用它。

  

此页面顶部有一个蓝色大按钮,可应用Google Video Intelligence

当/如果谷歌授予您测试版权限时,您应该会收到一封电子邮件,其中包含支持和反馈信息。这通常是Google群组中的私人群组。

阅读完评论后,我想知道您是否已被授予访问权限。如果您的访问权限没有通过,则无法提出任何请求。

答案 1 :(得分:0)

我遇到了类似的问题。对我而言,它与我试图用来授权的服务帐户相关(设置GOOGLE_APPLICATION_CREDENTIALS环境变量对我来说不起作用),但是

gcloud auth activate-service-account --key-file service-account-key-file

(使用您在these步骤之后创建的json)。

不确定原因,因为环境变量应优先于this