Skip to content

PollyClient#

Index > Polly > PollyClient

Auto-generated documentation for Polly type annotations stubs module mypy-boto3-polly.

PollyClient#

Type annotations and code completion for boto3.client("polly"). boto3 documentation

# PollyClient usage example

from boto3.session import Session
from mypy_boto3_polly.client import PollyClient

def get_polly_client() -> PollyClient:
    return Session().client("polly")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("polly").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("polly")

try:
    do_something(client)
except (
    client.exceptions.ClientError,
    client.exceptions.EngineNotSupportedException,
    client.exceptions.InvalidLexiconException,
    client.exceptions.InvalidNextTokenException,
    client.exceptions.InvalidS3BucketException,
    client.exceptions.InvalidS3KeyException,
    client.exceptions.InvalidSampleRateException,
    client.exceptions.InvalidSnsTopicArnException,
    client.exceptions.InvalidSsmlException,
    client.exceptions.InvalidTaskIdException,
    client.exceptions.LanguageNotSupportedException,
    client.exceptions.LexiconNotFoundException,
    client.exceptions.LexiconSizeExceededException,
    client.exceptions.MarksNotSupportedForFormatException,
    client.exceptions.MaxLexemeLengthExceededException,
    client.exceptions.MaxLexiconsNumberExceededException,
    client.exceptions.ServiceFailureException,
    client.exceptions.SsmlMarksNotSupportedForTextTypeException,
    client.exceptions.SynthesisTaskNotFoundException,
    client.exceptions.TextLengthExceededException,
    client.exceptions.UnsupportedPlsAlphabetException,
    client.exceptions.UnsupportedPlsLanguageException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_polly.client import Exceptions

def handle_error(exc: Exceptions.ClientError) -> None:
    ...

Methods#

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("polly").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("polly").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

delete_lexicon#

Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region.

Type annotations and code completion for boto3.client("polly").delete_lexicon method. boto3 documentation

# delete_lexicon method definition

def delete_lexicon(
    self,
    *,
    Name: str,
) -> Dict[str, Any]:
    ...
# delete_lexicon method usage example with argument unpacking

kwargs: DeleteLexiconInputRequestTypeDef = {  # (1)
    "Name": ...,
}

parent.delete_lexicon(**kwargs)
  1. See DeleteLexiconInputRequestTypeDef

describe_voices#

Returns the list of voices that are available for use when requesting speech synthesis.

Type annotations and code completion for boto3.client("polly").describe_voices method. boto3 documentation

# describe_voices method definition

def describe_voices(
    self,
    *,
    Engine: EngineType = ...,  # (1)
    LanguageCode: LanguageCodeType = ...,  # (2)
    IncludeAdditionalLanguageCodes: bool = ...,
    NextToken: str = ...,
) -> DescribeVoicesOutputTypeDef:  # (3)
    ...
  1. See EngineType
  2. See LanguageCodeType
  3. See DescribeVoicesOutputTypeDef
# describe_voices method usage example with argument unpacking

kwargs: DescribeVoicesInputRequestTypeDef = {  # (1)
    "Engine": ...,
}

parent.describe_voices(**kwargs)
  1. See DescribeVoicesInputRequestTypeDef

generate_presigned_url#

Generate a presigned url given a client, its method, and arguments.

Type annotations and code completion for boto3.client("polly").generate_presigned_url method. boto3 documentation

# generate_presigned_url method definition

def generate_presigned_url(
    self,
    ClientMethod: str,
    Params: Mapping[str, Any] = ...,
    ExpiresIn: int = 3600,
    HttpMethod: str = ...,
) -> str:
    ...

get_lexicon#

Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region.

Type annotations and code completion for boto3.client("polly").get_lexicon method. boto3 documentation

# get_lexicon method definition

def get_lexicon(
    self,
    *,
    Name: str,
) -> GetLexiconOutputTypeDef:  # (1)
    ...
  1. See GetLexiconOutputTypeDef
# get_lexicon method usage example with argument unpacking

kwargs: GetLexiconInputRequestTypeDef = {  # (1)
    "Name": ...,
}

parent.get_lexicon(**kwargs)
  1. See GetLexiconInputRequestTypeDef

get_speech_synthesis_task#

Retrieves a specific SpeechSynthesisTask object based on its TaskID.

Type annotations and code completion for boto3.client("polly").get_speech_synthesis_task method. boto3 documentation

# get_speech_synthesis_task method definition

def get_speech_synthesis_task(
    self,
    *,
    TaskId: str,
) -> GetSpeechSynthesisTaskOutputTypeDef:  # (1)
    ...
  1. See GetSpeechSynthesisTaskOutputTypeDef
# get_speech_synthesis_task method usage example with argument unpacking

kwargs: GetSpeechSynthesisTaskInputRequestTypeDef = {  # (1)
    "TaskId": ...,
}

parent.get_speech_synthesis_task(**kwargs)
  1. See GetSpeechSynthesisTaskInputRequestTypeDef

list_lexicons#

Returns a list of pronunciation lexicons stored in an Amazon Web Services Region.

Type annotations and code completion for boto3.client("polly").list_lexicons method. boto3 documentation

# list_lexicons method definition

def list_lexicons(
    self,
    *,
    NextToken: str = ...,
) -> ListLexiconsOutputTypeDef:  # (1)
    ...
  1. See ListLexiconsOutputTypeDef
# list_lexicons method usage example with argument unpacking

kwargs: ListLexiconsInputRequestTypeDef = {  # (1)
    "NextToken": ...,
}

parent.list_lexicons(**kwargs)
  1. See ListLexiconsInputRequestTypeDef

list_speech_synthesis_tasks#

Returns a list of SpeechSynthesisTask objects ordered by their creation date.

Type annotations and code completion for boto3.client("polly").list_speech_synthesis_tasks method. boto3 documentation

# list_speech_synthesis_tasks method definition

def list_speech_synthesis_tasks(
    self,
    *,
    MaxResults: int = ...,
    NextToken: str = ...,
    Status: TaskStatusType = ...,  # (1)
) -> ListSpeechSynthesisTasksOutputTypeDef:  # (2)
    ...
  1. See TaskStatusType
  2. See ListSpeechSynthesisTasksOutputTypeDef
# list_speech_synthesis_tasks method usage example with argument unpacking

kwargs: ListSpeechSynthesisTasksInputRequestTypeDef = {  # (1)
    "MaxResults": ...,
}

parent.list_speech_synthesis_tasks(**kwargs)
  1. See ListSpeechSynthesisTasksInputRequestTypeDef

put_lexicon#

Stores a pronunciation lexicon in an Amazon Web Services Region.

Type annotations and code completion for boto3.client("polly").put_lexicon method. boto3 documentation

# put_lexicon method definition

def put_lexicon(
    self,
    *,
    Name: str,
    Content: str,
) -> Dict[str, Any]:
    ...
# put_lexicon method usage example with argument unpacking

kwargs: PutLexiconInputRequestTypeDef = {  # (1)
    "Name": ...,
    "Content": ...,
}

parent.put_lexicon(**kwargs)
  1. See PutLexiconInputRequestTypeDef

start_speech_synthesis_task#

Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask.

Type annotations and code completion for boto3.client("polly").start_speech_synthesis_task method. boto3 documentation

# start_speech_synthesis_task method definition

def start_speech_synthesis_task(
    self,
    *,
    OutputFormat: OutputFormatType,  # (1)
    OutputS3BucketName: str,
    Text: str,
    VoiceId: VoiceIdType,  # (2)
    Engine: EngineType = ...,  # (3)
    LanguageCode: LanguageCodeType = ...,  # (4)
    LexiconNames: Sequence[str] = ...,
    OutputS3KeyPrefix: str = ...,
    SampleRate: str = ...,
    SnsTopicArn: str = ...,
    SpeechMarkTypes: Sequence[SpeechMarkTypeType] = ...,  # (5)
    TextType: TextTypeType = ...,  # (6)
) -> StartSpeechSynthesisTaskOutputTypeDef:  # (7)
    ...
  1. See OutputFormatType
  2. See VoiceIdType
  3. See EngineType
  4. See LanguageCodeType
  5. See SpeechMarkTypeType
  6. See TextTypeType
  7. See StartSpeechSynthesisTaskOutputTypeDef
# start_speech_synthesis_task method usage example with argument unpacking

kwargs: StartSpeechSynthesisTaskInputRequestTypeDef = {  # (1)
    "OutputFormat": ...,
    "OutputS3BucketName": ...,
    "Text": ...,
    "VoiceId": ...,
}

parent.start_speech_synthesis_task(**kwargs)
  1. See StartSpeechSynthesisTaskInputRequestTypeDef

synthesize_speech#

Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes.

Type annotations and code completion for boto3.client("polly").synthesize_speech method. boto3 documentation

# synthesize_speech method definition

def synthesize_speech(
    self,
    *,
    OutputFormat: OutputFormatType,  # (1)
    Text: str,
    VoiceId: VoiceIdType,  # (2)
    Engine: EngineType = ...,  # (3)
    LanguageCode: LanguageCodeType = ...,  # (4)
    LexiconNames: Sequence[str] = ...,
    SampleRate: str = ...,
    SpeechMarkTypes: Sequence[SpeechMarkTypeType] = ...,  # (5)
    TextType: TextTypeType = ...,  # (6)
) -> SynthesizeSpeechOutputTypeDef:  # (7)
    ...
  1. See OutputFormatType
  2. See VoiceIdType
  3. See EngineType
  4. See LanguageCodeType
  5. See SpeechMarkTypeType
  6. See TextTypeType
  7. See SynthesizeSpeechOutputTypeDef
# synthesize_speech method usage example with argument unpacking

kwargs: SynthesizeSpeechInputRequestTypeDef = {  # (1)
    "OutputFormat": ...,
    "Text": ...,
    "VoiceId": ...,
}

parent.synthesize_speech(**kwargs)
  1. See SynthesizeSpeechInputRequestTypeDef

get_paginator#

Type annotations and code completion for boto3.client("polly").get_paginator method with overloads.