data may be None if twitter data property unconfigured: File "/opt/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/components/notify/twitter.py", line 63, in send_message media = data.get(ATTR_MEDIA)pull/8413/merge
parent
1a1571cd52
commit
c67c20f752
|
@ -60,10 +60,13 @@ class TwitterNotificationService(BaseNotificationService):
|
|||
def send_message(self, message="", **kwargs):
|
||||
"""Tweet a message, optionally with media."""
|
||||
data = kwargs.get(ATTR_DATA)
|
||||
media = data.get(ATTR_MEDIA)
|
||||
if not self.hass.config.is_allowed_path(media):
|
||||
_LOGGER.warning("'%s' is not in a whitelisted area.", media)
|
||||
return
|
||||
|
||||
media = None
|
||||
if data:
|
||||
media = data.get(ATTR_MEDIA)
|
||||
if not self.hass.config.is_allowed_path(media):
|
||||
_LOGGER.warning("'%s' is not in a whitelisted area.", media)
|
||||
return
|
||||
|
||||
media_id = self.upload_media(media)
|
||||
|
||||
|
|
Loading…
Reference in New Issue