Standard

Standard Skill Builder

class ask_sdk.standard.StandardSkillBuilder(table_name=None, auto_create_table=None, partition_keygen=None, dynamodb_client=None)

Bases: ask_sdk_core.skill_builder.SkillBuilder

Skill Builder with api client and db adapter coupling to Skill.

Standard Skill Builder is an implementation of ask_sdk_core.skill_builder.SkillBuilder with coupling of DynamoDb Persistence Adapter settings and a Default Api Client added to the ask_sdk_core.skill.Skill.

Parameters:
  • table_name (str) – Name of the table to be created or used
  • auto_create_table (bool) – Should the adapter try to create the table if it doesn’t exist.
  • partition_keygen (Callable[[RequestEnvelope], str]) – Callable function that takes a request envelope and provides a unique partition key value.
  • dynamodb_client (boto3.resources.base.ServiceResource) – Resource to be used, to perform dynamo operations.
add_custom_user_agent(user_agent)

Adds the user agent to the skill instance.

This method adds the passed in user_agent to the skill, which is reflected in the skill’s response envelope.

Parameters:user_agent (str) – Custom User Agent string provided by the developer.
Return type:None
add_exception_handler(exception_handler)

Register input to the exception handlers list.

Parameters:exception_handler (ask_sdk_runtime.dispatch_components.request_components.AbstractExceptionHandler) – Exception Handler instance to be registered.
Returns:None
add_global_request_interceptor(request_interceptor)

Register input to the global request interceptors list.

Parameters:request_interceptor (ask_sdk_runtime.dispatch_components.request_components.AbstractRequestInterceptor) – Request Interceptor instance to be registered.
Returns:None
add_global_response_interceptor(response_interceptor)

Register input to the global response interceptors list.

Parameters:response_interceptor (ask_sdk_runtime.dispatch_components.request_components.AbstractResponseInterceptor) – Response Interceptor instance to be registered.
Returns:None
add_loader(loader)

Register input to loaders list.

Parameters:loader (ask_sdk_runtime.view_resolvers.AbstractTemplateLoader) – Loader to load template from a specific data source
add_loaders(loaders)

Register input to the loaders list.

Parameters:loaders (ask_sdk_runtime.view_resolvers.AbstractTemplateLoader) – List of loaders
add_renderer(renderer)

Register renderer to generate template responses.

Parameters:renderer (ask_sdk_runtime.view_resolvers.AbstractTemplateRenderer) – Renderer to render the template
add_request_handler(request_handler)

Register input to the request handlers list.

Parameters:request_handler (ask_sdk_runtime.dispatch_components.request_components.AbstractRequestHandler) – Request Handler instance to be registered.
Returns:None
create()

Create a skill object using the registered components.

Returns:a skill object that can be used for invocation.
Return type:Skill
exception_handler(can_handle_func)

Decorator that can be used to add exception handlers easily to the builder.

The can_handle_func has to be a Callable instance, which takes two parameters and no varargs or kwargs. This is because of the ExceptionHandler class signature restrictions. The returned wrapper function can be applied as a decorator on any function that processes the exception raised during dispatcher and returns a response object by the skill. The function should follow the signature of the handle function in ask_sdk_runtime.dispatch_components.exception_components.AbstractExceptionHandler class.

Parameters:can_handle_func (Callable[[Input, Exception], bool]) – The function that validates if the exception can be handled.
Returns:Wrapper function that can be decorated on a handle function.
global_request_interceptor()

Decorator that can be used to add global request interceptors easily to the builder.

The returned wrapper function can be applied as a decorator on any function that processes the input. The function should follow the signature of the process function in ask_sdk_runtime.dispatch_components.request_components.AbstractRequestInterceptor class.

Returns:Wrapper function that can be decorated on a interceptor process function.
global_response_interceptor()

Decorator that can be used to add global response interceptors easily to the builder.

The returned wrapper function can be applied as a decorator on any function that processes the input and the response generated by the request handler. The function should follow the signature of the process function in ask_sdk_runtime.dispatch_components.request_components.AbstractResponseInterceptor class.

Returns:Wrapper function that can be decorated on a interceptor process function.
lambda_handler()

Create a handler function that can be used as handler in AWS Lambda console.

The lambda handler provides a handler function, that acts as an entry point to the AWS Lambda console. Users can set the lambda_handler output to a variable and set the variable as AWS Lambda Handler on the console.

As mentioned in the AWS Lambda Handler docs, the handler function receives the event attribute as a str representing the input request envelope JSON from Alexa service, which is deserialized to ask_sdk_model.request_envelope.RequestEnvelope, before invoking the skill. The output from the handler function would be the serialized ask_sdk_model.response_envelope.ResponseEnvelope class from the appropriate skill handler.

Returns:Handler function to tag on AWS Lambda console.
request_handler(can_handle_func)

Decorator that can be used to add request handlers easily to the builder.

The can_handle_func has to be a Callable instance, which takes a single parameter and no varargs or kwargs. This is because of the RequestHandler class signature restrictions. The returned wrapper function can be applied as a decorator on any function that returns a response object by the skill. The function should follow the signature of the handle function in ask_sdk_runtime.dispatch_components.request_components.AbstractRequestHandler class.

Parameters:can_handle_func (Callable[[Input], bool]) – The function that validates if the request can be handled.
Returns:Wrapper function that can be decorated on a handle function.
skill_configuration

Create the skill configuration object using the registered components.