本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
StartSpeechSynthesisTask
AWS SDK for Python (Boto) 以下 Python 代码示例使用列出您账户中位于本地 AWS 配置中指定区域的词典。有关创建配置文件的信息,请参阅 设置 AWS CLI。
有关更多信息,请参阅的参考资料StartSpeechSynthesisTask
API。
import boto3 import time polly_client = boto3.Session( aws_access_key_id='', aws_secret_access_key='', region_name='eu-west-2').client('polly') response = polly_client.start_speech_synthesis_task(VoiceId='Joanna', OutputS3BucketName='synth-books-buckets', OutputS3KeyPrefix='key', OutputFormat='mp3', Text='This is a sample text to be synthesized.', Engine='neural') taskId = response['SynthesisTask']['TaskId'] print( "Task id is {} ".format(taskId)) task_status = polly_client.get_speech_synthesis_task(TaskId = taskId) print(task_status)