airflow.providers.google.cloud.hooks.text_to_speech

此模块包含一个 Google Cloud Text to Speech Hook。

CloudTextToSpeechHook

Google Cloud Text to Speech API 的 Hook。

模块内容

class airflow.providers.google.cloud.hooks.text_to_speech.CloudTextToSpeechHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]

基类: airflow.providers.google.common.hooks.base_google.GoogleBaseHook

Google Cloud Text to Speech API 的 Hook。

Hook 中所有使用 project_id 的方法都必须使用关键字参数调用,而非位置参数。

参数
  • gcp_conn_id (str) – 获取连接信息时使用的连接 ID。

  • impersonation_chain (str | collections.abc.Sequence[str] | None) – 可选的服务账号,用于使用短期凭证进行模拟,或获取列表中最后一个账号的 access_token 所需的账号链,该账号将在请求中被模拟。如果设置为字符串,该账号必须授予发起账号 Service Account Token Creator IAM 角色。如果设置为序列,列表中的身份必须授予直接前一个身份 Service Account Token Creator IAM 角色,列表中第一个账号授予发起账号此角色。

get_conn()[source]

检索与 Cloud Text to Speech 的连接。

返回

Google Cloud Text to Speech 客户端对象。

返回类型

google.cloud.texttospeech_v1.TextToSpeechClient

synthesize_speech(input_data, voice, audio_config, retry=DEFAULT, timeout=None)[source]

合成文本输入。

参数
返回

SynthesizeSpeechResponse 详情见: https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.SynthesizeSpeechResponse

返回类型

google.cloud.texttospeech_v1.types.SynthesizeSpeechResponse

此条目是否有帮助?