

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# StartSpeechSynthesisTask
<a name="StartSpeechSynthesisTaskSamplePython"></a>

下列 Python 程式碼範例使用 在本機 AWS 組態中指定的區域中 適用於 Python (Boto) 的 AWS SDK ，列出您帳戶中的語彙。如需建立組態檔的資訊，請參閱「[設定AWS CLI](setup-cli.md)」。

如需詳細資訊，請參閱 [https://docs.aws.amazon.com/polly/latest/dg/API_StartSpeechSynthesisTask.html](https://docs.aws.amazon.com/polly/latest/dg/API_StartSpeechSynthesisTask.html) 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)
```