Move imports in message_bird component (#28022)

This commit is contained in:
Diefferson Koderer Môro 2019-10-21 04:48:25 -03:00 committed by Fabian Affolter
parent ff3c0e5697
commit 4bb82fa8ad
1 changed files with 4 additions and 7 deletions

View File

@ -1,16 +1,17 @@
"""MessageBird platform for notify component."""
import logging
import messagebird
from messagebird.client import ErrorException
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_SENDER
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (
ATTR_TARGET,
PLATFORM_SCHEMA,
BaseNotificationService,
)
from homeassistant.const import CONF_API_KEY, CONF_SENDER
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
@ -26,8 +27,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def get_service(hass, config, discovery_info=None):
"""Get the MessageBird notification service."""
import messagebird
client = messagebird.Client(config[CONF_API_KEY])
try:
# validates the api key
@ -49,8 +48,6 @@ class MessageBirdNotificationService(BaseNotificationService):
def send_message(self, message=None, **kwargs):
"""Send a message to a specified target."""
from messagebird.client import ErrorException
targets = kwargs.get(ATTR_TARGET)
if not targets:
_LOGGER.error("No target specified")