Creates a preview of the MIME content of an email when provided with a template and a set of replacement data.
You can execute this operation no more than once per second.
Parameters:
-
template_name
(TemplateName)
–
The name of the template to render.
-
template_data
(TemplateData)
–
A list of replacement values to apply to the template. This parameter is a JSON object, typically consisting of key-value pairs in which the keys correspond to replacement tags in the email template.
Raises:
-
InvalidRenderingParameterException
–
Indicates that one or more of the replacement values you provided is invalid. This error may occur when the TemplateData object contains invalid JSON.
-
MissingRenderingAttributeException
–
Indicates that one or more of the replacement values for the specified template was not specified. Ensure that the TemplateData object contains references to all of the replacement tags in the specified template.
-
TemplateDoesNotExistException
–
Indicates that the Template object you specified does not exist in your Amazon SES account.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_ses/_services/async_ses.py
| async def test_render_template(
self,
template_name: "capo_ses.types.template_name.TemplateName",
template_data: "capo_ses.types.template_data.TemplateData",
*,
config_overrides: Optional[AsyncSESClientConfig] = None,
) -> "capo_ses.types.test_render_template_response.TestRenderTemplateResponse":
"""<p>Creates a preview of the MIME content of an email when provided with a template and a set of replacement data.</p> <p>You can execute this operation no more than once per second.</p>
Args:
template_name: <p>The name of the template to render.</p>
template_data: <p>A list of replacement values to apply to the template. This parameter is a JSON object, typically consisting of key-value pairs in which the keys correspond to replacement tags in the email template.</p>
Raises:
capo_ses.errors.invalid_rendering_parameter_exception.InvalidRenderingParameterException: <p>Indicates that one or more of the replacement values you provided is invalid. This error may occur when the TemplateData object contains invalid JSON.</p>
capo_ses.errors.missing_rendering_attribute_exception.MissingRenderingAttributeException: <p>Indicates that one or more of the replacement values for the specified template was not specified. Ensure that the TemplateData object contains references to all of the replacement tags in the specified template.</p>
capo_ses.errors.template_does_not_exist_exception.TemplateDoesNotExistException: <p>Indicates that the Template object you specified does not exist in your Amazon SES account.</p>
capo_ses.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_ses.types.test_render_template_request.TestRenderTemplateRequest]",
) -> AsyncOperationResponse[
"capo_ses.types.test_render_template_response.TestRenderTemplateResponse"
]:
import capo_ses._operations.simple_email_service.test_render_template
(
output,
http_response,
) = await capo_ses._operations.simple_email_service.test_render_template.async_test_render_template(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("TestRenderTemplate")
)
input_: capo_ses.types.test_render_template_request.TestRenderTemplateRequest = {
"template_name": template_name,
"template_data": template_data,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|