Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
Parameters:
Raises:
-
LexiconNotFoundException
–
Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
-
ServiceFailureException
–
An unknown condition has caused a service failure.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_polly/_services/polly.py
| def get_lexicon(
self,
name: "capo_polly.types.lexicon_name.LexiconName",
*,
config_overrides: Optional[PollyClientConfig] = None,
) -> "capo_polly.types.get_lexicon_output.GetLexiconOutput":
"""<p>Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see <a href="https://docs.aws.amazon.com/polly/latest/dg/managing-lexicons.html">Managing Lexicons</a>.</p>
Args:
name: <p>Name of the lexicon.</p>
Raises:
capo_polly.errors.lexicon_not_found_exception.LexiconNotFoundException: <p>Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its name is misspelled or specifying a lexicon that is in a different region.</p> <p>Verify that the lexicon exists, is in the region (see <a>ListLexicons</a>) and that you spelled its name is spelled correctly. Then try again.</p>
capo_polly.errors.service_failure_exception.ServiceFailureException: <p>An unknown condition has caused a service failure.</p>
capo_polly.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_polly.types.get_lexicon_input.GetLexiconInput]",
) -> OperationResponse["capo_polly.types.get_lexicon_output.GetLexiconOutput"]:
import capo_polly._operations.parrot_v1.get_lexicon
output, http_response = (
capo_polly._operations.parrot_v1.get_lexicon.get_lexicon(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_polly.types.get_lexicon_output.GetLexiconOutput",
) -> dict[str, Any]:
import capo_polly.types.get_lexicon_output
return capo_polly.types.get_lexicon_output.redact_sensitive(output)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("GetLexicon", redact_output=_redact_output),
)
input_: capo_polly.types.get_lexicon_input.GetLexiconInput = {"name": name}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|