How to use the alexapy.AlexapyConnectionError 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 eliseomartelli / ParentsHomeAutomation / homeassistant / custom_components / alexa_media / config_flow.py View on Github external
if not self.login:
                _LOGGER.debug("Creating new login")
                self.login = AlexaLogin(
                    self.config[CONF_URL],
                    self.config[CONF_EMAIL],
                    self.config[CONF_PASSWORD],
                    self.hass.config.path,
                    self.config[CONF_DEBUG],
                )
                await self.login.login_with_cookie()
                return await self._test_login()
            else:
                _LOGGER.debug("Using existing login")
                await self.login.login(data=user_input)
                return await self._test_login()
        except AlexapyConnectionError:
            return await self._show_form(errors={"base": "connection_error"})
        except BaseException as ex:
            _LOGGER.warning("Unknown error: %s", ex)
            return await self._show_form(errors={"base": "unknown_error"})
github aneisch / home-assistant-config / custom_components / alexa_media / config_flow.py View on Github external
async def async_step_process(self, user_input=None):
        """Handle the input processing of the config flow."""
        if user_input:
            if CONF_PASSWORD in user_input:
                password = user_input[CONF_PASSWORD]
                self.config[CONF_PASSWORD] = password
            try:
                await self.login.login(data=user_input)
            except AlexapyConnectionError:
                return await self._show_form(
                    errors={"base": "connection_error"})
            except BaseException as ex:
                _LOGGER.warning("Unknown error: %s", ex)
                return await self._show_form(errors={"base": "unknown_error"})
        return await self._test_login()
github eifinger / homeassistant-config / custom_components / alexa_media / config_flow.py View on Github external
if not self.login:
                _LOGGER.debug("Creating new login")
                self.login = AlexaLogin(
                    self.config[CONF_URL],
                    self.config[CONF_EMAIL],
                    self.config[CONF_PASSWORD],
                    self.hass.config.path,
                    self.config[CONF_DEBUG],
                )
                await self.login.login_with_cookie()
                return await self._test_login()
            else:
                _LOGGER.debug("Using existing login")
                await self.login.login(data=user_input)
                return await self._test_login()
        except AlexapyConnectionError:
            return await self._show_form(errors={"base": "connection_error"})
        except BaseException as ex:
            _LOGGER.warning("Unknown error: %s", ex)
            return await self._show_form(errors={"base": "unknown_error"})