Amazon Polly
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门


以下 Python 代码示例使用AWS SDK for Python (Boto)在本地 AWS 配置中指定的区域中列出您的账户中的词典。有关创建配置文件的信息,请参阅 步骤 3.1:设置 AWS Command Line Interface (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.') taskId = response['SynthesisTask']['TaskId'] print "Task id is {} ".format(taskId) task_status = polly_client.get_speech_synthesis_task(TaskId = taskId) print task_status