Merge pull request #18895 from home-assistant/upgrade-slacker
Upgrade slacker to 0.11.0pull/18892/head^2
commit
253dc66129
|
@ -17,7 +17,7 @@ from homeassistant.components.notify import (
|
||||||
BaseNotificationService)
|
BaseNotificationService)
|
||||||
from homeassistant.const import (CONF_API_KEY, CONF_USERNAME, CONF_ICON)
|
from homeassistant.const import (CONF_API_KEY, CONF_USERNAME, CONF_ICON)
|
||||||
|
|
||||||
REQUIREMENTS = ['slacker==0.9.65']
|
REQUIREMENTS = ['slacker==0.11.0']
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -39,14 +39,15 @@ ATTR_FILE_AUTH_DIGEST = 'digest'
|
||||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||||
vol.Required(CONF_API_KEY): cv.string,
|
vol.Required(CONF_API_KEY): cv.string,
|
||||||
vol.Required(CONF_CHANNEL): cv.string,
|
vol.Required(CONF_CHANNEL): cv.string,
|
||||||
vol.Optional(CONF_USERNAME): cv.string,
|
|
||||||
vol.Optional(CONF_ICON): cv.string,
|
vol.Optional(CONF_ICON): cv.string,
|
||||||
|
vol.Optional(CONF_USERNAME): cv.string,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
def get_service(hass, config, discovery_info=None):
|
def get_service(hass, config, discovery_info=None):
|
||||||
"""Get the Slack notification service."""
|
"""Get the Slack notification service."""
|
||||||
import slacker
|
import slacker
|
||||||
|
|
||||||
channel = config.get(CONF_CHANNEL)
|
channel = config.get(CONF_CHANNEL)
|
||||||
api_key = config.get(CONF_API_KEY)
|
api_key = config.get(CONF_API_KEY)
|
||||||
username = config.get(CONF_USERNAME)
|
username = config.get(CONF_USERNAME)
|
||||||
|
@ -115,15 +116,15 @@ class SlackNotificationService(BaseNotificationService):
|
||||||
'content': None,
|
'content': None,
|
||||||
'filetype': None,
|
'filetype': None,
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
# if optional title is none use the filename
|
# If optional title is none use the filename
|
||||||
'title': title if title else filename,
|
'title': title if title else filename,
|
||||||
'initial_comment': message,
|
'initial_comment': message,
|
||||||
'channels': target
|
'channels': target
|
||||||
}
|
}
|
||||||
# Post to slack
|
# Post to slack
|
||||||
self.slack.files.post('files.upload',
|
self.slack.files.post(
|
||||||
data=data,
|
'files.upload', data=data,
|
||||||
files={'file': file_as_bytes})
|
files={'file': file_as_bytes})
|
||||||
else:
|
else:
|
||||||
self.slack.chat.post_message(
|
self.slack.chat.post_message(
|
||||||
target, message, as_user=self._as_user,
|
target, message, as_user=self._as_user,
|
||||||
|
@ -154,13 +155,13 @@ class SlackNotificationService(BaseNotificationService):
|
||||||
elif local_path:
|
elif local_path:
|
||||||
# Check whether path is whitelisted in configuration.yaml
|
# Check whether path is whitelisted in configuration.yaml
|
||||||
if self.is_allowed_path(local_path):
|
if self.is_allowed_path(local_path):
|
||||||
return open(local_path, "rb")
|
return open(local_path, 'rb')
|
||||||
_LOGGER.warning("'%s' is not secure to load data from!",
|
_LOGGER.warning(
|
||||||
local_path)
|
"'%s' is not secure to load data from!", local_path)
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning("Neither URL nor local path found in params!")
|
_LOGGER.warning("Neither URL nor local path found in params!")
|
||||||
|
|
||||||
except OSError as error:
|
except OSError as error:
|
||||||
_LOGGER.error("Can't load from url or local path: %s", error)
|
_LOGGER.error("Can't load from URL or local path: %s", error)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -1427,7 +1427,7 @@ sisyphus-control==2.1
|
||||||
skybellpy==0.1.2
|
skybellpy==0.1.2
|
||||||
|
|
||||||
# homeassistant.components.notify.slack
|
# homeassistant.components.notify.slack
|
||||||
slacker==0.9.65
|
slacker==0.11.0
|
||||||
|
|
||||||
# homeassistant.components.sleepiq
|
# homeassistant.components.sleepiq
|
||||||
sleepyq==0.6
|
sleepyq==0.6
|
||||||
|
|
Loading…
Reference in New Issue