How to use the alexapy.AlexapyLoginCloseRequested function in AlexaPy

To help you get started, we’ve selected a few AlexaPy 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 eifinger / homeassistant-config / custom_components / alexa_media / helpers.py View on Github external
async def wrapper(*args, **kwargs) -> Any:
        instance = args[0]
        result = None
        if hasattr(instance, "check_login_changes"):
            instance.check_login_changes()
        try:
            result = await func(*args, **kwargs)
        except AlexapyLoginCloseRequested:
            _LOGGER.debug(
                "%s.%s: Ignoring attempt to access Alexa after HA shutdown",
                func.__module__[func.__module__.find(".") + 1 :],
                func.__name__,
            )
            return None
        except AlexapyLoginError as ex:
            _LOGGER.debug(
                "%s.%s: detected bad login: %s",
                func.__module__[func.__module__.find(".") + 1 :],
                func.__name__,
                EXCEPTION_TEMPLATE.format(type(ex).__name__, ex.args),
            )
            instance = args[0]
            if hasattr(instance, "_login"):
                login = instance._login