airflow.providers.google.cloud.hooks.text_to_speech
¶
此模組包含一個 Google Cloud Text to Speech Hook。
模組內容¶
類別¶
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)[原始碼]¶
基底:
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 的鏈式帳戶列表,該帳戶將在請求中被模擬。如果設定為字串,則帳戶必須授予原始帳戶「服務帳戶權杖建立者」IAM 角色。如果設定為序列,則列表中的身分必須將「服務帳戶權杖建立者」IAM 角色授予緊鄰的前一個身分,列表中的第一個帳戶將此角色授予原始帳戶。
- get_conn()[原始碼]¶
檢索到 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)[原始碼]¶
合成文字輸入。
- 參數
input_data (dict | google.cloud.texttospeech_v1.types.SynthesisInput) – 要合成的文字輸入。參閱更多: https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.SynthesisInput
voice (dict | google.cloud.texttospeech_v1.types.VoiceSelectionParams) – 用於合成的語音配置。參閱更多: https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.VoiceSelectionParams
audio_config (dict | google.cloud.texttospeech_v1.types.AudioConfig) – 合成音訊的配置。參閱更多: https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.AudioConfig
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – (可選) 用於重試請求的重試物件。如果未指定,則不會重試請求。
timeout (float | None) – (可選) 等待請求完成的時間量(秒)。請注意,如果指定了重試,則逾時適用於每次個別嘗試。
- 返回
SynthesizeSpeechResponse 參閱更多: https://googleapis.github.io/google-cloud-python/latest/texttospeech/gapic/v1/types.html#google.cloud.texttospeech_v1.types.SynthesizeSpeechResponse
- 返回類型