diff --git a/homeassistant/components/slack/notify.py b/homeassistant/components/slack/notify.py index 1b9895aab76..b645a590c3c 100644 --- a/homeassistant/components/slack/notify.py +++ b/homeassistant/components/slack/notify.py @@ -3,11 +3,10 @@ import logging import requests from requests.auth import HTTPBasicAuth, HTTPDigestAuth +import slacker +from slacker import Slacker import voluptuous as vol -from homeassistant.const import CONF_API_KEY, CONF_ICON, CONF_USERNAME -import homeassistant.helpers.config_validation as cv - from homeassistant.components.notify import ( ATTR_DATA, ATTR_TARGET, @@ -15,6 +14,8 @@ from homeassistant.components.notify import ( PLATFORM_SCHEMA, BaseNotificationService, ) +from homeassistant.const import CONF_API_KEY, CONF_ICON, CONF_USERNAME +import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) @@ -45,7 +46,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( def get_service(hass, config, discovery_info=None): """Get the Slack notification service.""" - import slacker channel = config.get(CONF_CHANNEL) api_key = config.get(CONF_API_KEY) @@ -67,7 +67,6 @@ class SlackNotificationService(BaseNotificationService): def __init__(self, default_channel, api_token, username, icon, is_allowed_path): """Initialize the service.""" - from slacker import Slacker self._default_channel = default_channel self._api_token = api_token @@ -84,7 +83,6 @@ class SlackNotificationService(BaseNotificationService): def send_message(self, message="", **kwargs): """Send a message to a user.""" - import slacker if kwargs.get(ATTR_TARGET) is None: targets = [self._default_channel] diff --git a/homeassistant/components/socialblade/sensor.py b/homeassistant/components/socialblade/sensor.py index 0acfb63a629..3d53e76a27a 100644 --- a/homeassistant/components/socialblade/sensor.py +++ b/homeassistant/components/socialblade/sensor.py @@ -2,6 +2,7 @@ from datetime import timedelta import logging +import socialbladeclient import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA @@ -71,7 +72,6 @@ class SocialBladeSensor(Entity): @Throttle(MIN_TIME_BETWEEN_UPDATES) def update(self): """Get the latest data from Social Blade.""" - import socialbladeclient try: data = socialbladeclient.get_data(self.channel_id)