How to use the ask-sdk-model.ask_sdk_model.services.lwa.access_token_request.AccessTokenRequest function in ask-sdk-model

To help you get started, we’ve selected a few ask-sdk-model examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexa / alexa-apis-for-python / ask-sdk-model / ask_sdk_model / services / lwa / lwa_client.py View on Github external
"""
        if scope is None:
            cache_key = self.REFRESH_ACCESS_TOKEN
        else:
            cache_key = scope

        access_token = self._scoped_token_cache.get(cache_key, None)
        local_now = datetime.now(tz.tzutc())

        if (access_token is not None and
            access_token.expiry >
                local_now + timedelta(
                    milliseconds=self.EXPIRY_OFFSET_IN_MILLIS)):
            return access_token.token

        access_token_request = AccessTokenRequest(
            client_id=self._authentication_configuration.client_id,
            client_secret=self._authentication_configuration.client_secret)

        if self._authentication_configuration.refresh_token is None:
            access_token_request.scope = scope
        else:
            access_token_request.refresh_token = (
                self._authentication_configuration.refresh_token)

        lwa_response = self._generate_access_token(
            access_token_request=access_token_request)

        if lwa_response is None or lwa_response.expires_in is None:
            raise ValueError("Invalid response from LWA Client generate "
                             "access token call")
github alexa / alexa-apis-for-python / ask-sdk-model / ask_sdk_model / services / lwa / access_token_request.py View on Github external
def __eq__(self, other):
        # type: (object) -> bool
        """Returns true if both objects are equal"""
        if not isinstance(other, AccessTokenRequest):
            return False

        return self.__dict__ == other.__dict__

ask-sdk-model

The ASK SDK Model package provides model definitions, for building Alexa Skills.

Apache-2.0
Latest version published 9 months ago

Package Health Score

65 / 100
Full package analysis

Popular ask-sdk-model functions

Similar packages