airflow.providers.google.cloud.hooks.video_intelligence

此模組包含 Google Cloud Video Intelligence Hook。

模組內容

類別

CloudVideoIntelligenceHook

用於 Google Cloud Video Intelligence API 的 Hook。

class airflow.providers.google.cloud.hooks.video_intelligence.CloudVideoIntelligenceHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[原始碼]

繼承自: airflow.providers.google.common.hooks.base_google.GoogleBaseHook

用於 Google Cloud Video Intelligence API 的 Hook。

Hook 中所有使用 project_id 的方法都必須使用關鍵字引數而不是位置引數來呼叫。

參數
  • gcp_conn_id (str) – 取得連線資訊時使用的連線 ID。

  • impersonation_chain (str | collections.abc.Sequence[str] | None) – 選項性服務帳戶,用於使用短期憑證模擬,或用於取得列表中最後一個帳戶的 access_token 所需的鏈式帳戶列表,該帳戶將在請求中被模擬。如果設定為字串,則帳戶必須授予原始帳戶「服務帳戶權杖建立者」IAM 角色。如果設定為序列,則列表中的身分必須將「服務帳戶權杖建立者」IAM 角色授予緊鄰的前一個身分,列表中的第一個帳戶將此角色授予原始帳戶。

get_conn()[原始碼]

傳回 Gcp Video Intelligence Service 用戶端。

annotate_video(input_uri=None, input_content=None, features=None, video_context=None, output_uri=None, location=None, retry=DEFAULT, timeout=None, metadata=())[原始碼]

執行影片註解。

參數
  • input_uri (str | None) – 輸入影片位置。目前僅支援 Google Cloud Storage URI,必須以以下格式指定:gs://bucket-id/object-id

  • input_content (bytes | None) – 影片資料位元組。如果未設定,則應透過 input_uri 指定輸入影片。如果已設定,則應取消設定 input_uri

  • features (collections.abc.Sequence[google.cloud.videointelligence_v1.Feature] | None) – 請求的影片註解功能。

  • output_uri (str | None) – 選項性,應儲存輸出 (JSON 格式) 的位置。目前僅支援 Google Cloud Storage URI,必須以以下格式指定:gs://bucket-id/object-id

  • video_context (dict | google.cloud.videointelligence_v1.VideoContext | None) – 選項性,其他影片內容和/或特定於功能的參數。

  • location (str | None) – 選項性,應進行註解的雲端區域。支援的雲端區域:us-east1、us-west1、europe-west1、asia-east1。如果未指定區域,將根據影片檔案位置確定區域。

  • retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Retry 物件,用於確定何時/是否重試請求。如果未指定 None,則不會重試請求。

  • timeout (float | None) – 選項性,請求完成的等待時間(以秒為單位)。請注意,如果指定了 retry,則逾時適用於每個個別嘗試。

  • metadata (collections.abc.Sequence[tuple[str, str]]) – 選項性,提供給方法的其他 metadata。

此條目是否有幫助?