ask_sdk_model_runtime.lwa package¶
Submodules¶
Note
Canonical imports have been added in the __init__.py
of the package.
This helps in importing the class directly from the package, than
through the module.
For eg: if package a
has module b
with
class C
, you can do from a import C
instead of
from a.b import C
.
ask_sdk_model_runtime.lwa.access_token module¶
-
class
ask_sdk_model_runtime.lwa.access_token.
AccessToken
(token=None, expiry=None)¶ Bases:
object
Represents the access token provided by LWA (Login With Amazon).
This is a wrapper class over
ask_sdk_model_runtime.lwa.access_token_response.AccessTokenResponse
that retrieves and stores the access token, the expiry time from LWA response.Parameters: - token (str) – access token from LWA
- expiry (datetime) – exact timestamp in UTC datetime, which is the expiry time for this access token. This is set as the combined datetime of current system time when the LWA response is received and the expiry time in seconds, provided in the LWA response.
ask_sdk_model_runtime.lwa.access_token_request module¶
-
class
ask_sdk_model_runtime.lwa.access_token_request.
AccessTokenRequest
(client_id=None, client_secret=None, scope=None, refresh_token=None)¶ Bases:
object
Request for retrieving an access token from LWA.
Parameters: -
attribute_map
= {'client_id': 'client_id', 'client_secret': 'client_secret', 'refresh_token': 'refresh_token', 'scope': 'scope'}¶
-
deserialized_types
= {'client_id': 'str', 'client_secret': 'str', 'refresh_token': 'str', 'scope': 'str'}¶
-
to_dict
()¶ Returns the model properties as a dict
-
to_str
()¶ Returns the string representation of the model
-
ask_sdk_model_runtime.lwa.access_token_response module¶
-
class
ask_sdk_model_runtime.lwa.access_token_response.
AccessTokenResponse
(access_token=None, expires_in=None, scope=None, token_type=None)¶ Bases:
object
LWA response for retrieving an access token.
Parameters: -
attribute_map
= {'access_token': 'access_token', 'expires_in': 'expires_in', 'scope': 'scope', 'token_type': 'token_type'}¶
-
deserialized_types
= {'access_token': 'str', 'expires_in': 'int', 'scope': 'str', 'token_type': 'str'}¶
-
to_dict
()¶ Returns the model properties as a dict
-
to_str
()¶ Returns the string representation of the model
-
ask_sdk_model_runtime.lwa.error module¶
-
class
ask_sdk_model_runtime.lwa.error.
Error
(error_description=None, error_type=None)¶ Bases:
object
Error from LWA Client request.
Parameters: -
attribute_map
= {'error_description': 'error_description', 'error_type': 'error'}¶
-
deserialized_types
= {'error_description': 'str', 'error_type': 'str'}¶
-
to_dict
()¶ Returns the model properties as a dict
-
to_str
()¶ Returns the string representation of the model
-
ask_sdk_model_runtime.lwa.lwa_client module¶
-
class
ask_sdk_model_runtime.lwa.lwa_client.
LwaClient
(api_configuration, authentication_configuration, grant_type=None)¶ Bases:
ask_sdk_model_runtime.base_service_client.BaseServiceClient
Client to call Login with Amazon (LWA) to retrieve access tokens.
Parameters: - api_configuration (ask_sdk_model_runtime.api_configuration.ApiConfiguration) – ApiConfiguration instance with valid Serializer and ApiClient. The authorization value and api endpoint is not used by the LWA Client.
- authentication_configuration (ask_sdk_model_runtime.authentication_configuration.AuthenticationConfiguration) – AuthenticationConfiguration instance with valid client id and client secret, for making LWA calls.
- grant_type ((optional) str) – The grant type which is used to make the HTTP request.
Raises: ValueError
if authentication configuration is not provided.-
CLIENT_CREDENTIALS_GRANT_TYPE
= 'client_credentials'¶
-
DEFAULT_LWA_ENDPOINT
= 'https://api.amazon.com'¶
-
EXPIRY_OFFSET_IN_MILLIS
= 60000¶
-
LWA_CREDENTIALS_GRANT_TYPE
= 'refresh_token'¶
-
REFRESH_ACCESS_TOKEN
= 'refresh_access_token'¶
-
get_access_token_for_scope
(scope)¶ Retrieve access token for given scope.
Parameters: scope (str) – Target scope for the access token Returns: Retrieved access token for the given scope and configured client id, client secret Return type: str Raises: ValueError
is no scope is passed.