mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Small cleanup for slack (#16743)
This commit is contained in:
parent
e58836f99f
commit
c6ccbed828
@ -136,9 +136,9 @@ class SlackNotificationService(BaseNotificationService):
|
|||||||
password=None, auth=None):
|
password=None, auth=None):
|
||||||
"""Load image/document/etc from a local path or URL."""
|
"""Load image/document/etc from a local path or URL."""
|
||||||
try:
|
try:
|
||||||
if url is not None:
|
if url:
|
||||||
# Check whether authentication parameters are provided
|
# Check whether authentication parameters are provided
|
||||||
if username is not None and password is not None:
|
if username:
|
||||||
# Use digest or basic authentication
|
# Use digest or basic authentication
|
||||||
if ATTR_FILE_AUTH_DIGEST == auth:
|
if ATTR_FILE_AUTH_DIGEST == auth:
|
||||||
auth_ = HTTPDigestAuth(username, password)
|
auth_ = HTTPDigestAuth(username, password)
|
||||||
@ -151,7 +151,7 @@ class SlackNotificationService(BaseNotificationService):
|
|||||||
req = requests.get(url, timeout=CONF_TIMEOUT)
|
req = requests.get(url, timeout=CONF_TIMEOUT)
|
||||||
return req.content
|
return req.content
|
||||||
|
|
||||||
elif local_path is not None:
|
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")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user