From c6ccbed8283ecca4a589415e4f30a2eb3563415d Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 20 Sep 2018 15:14:43 +0200 Subject: [PATCH] Small cleanup for slack (#16743) --- homeassistant/components/notify/slack.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/notify/slack.py b/homeassistant/components/notify/slack.py index d4c5a196a3f..d576cdcc95e 100644 --- a/homeassistant/components/notify/slack.py +++ b/homeassistant/components/notify/slack.py @@ -136,9 +136,9 @@ class SlackNotificationService(BaseNotificationService): password=None, auth=None): """Load image/document/etc from a local path or URL.""" try: - if url is not None: + if url: # Check whether authentication parameters are provided - if username is not None and password is not None: + if username: # Use digest or basic authentication if ATTR_FILE_AUTH_DIGEST == auth: auth_ = HTTPDigestAuth(username, password) @@ -151,7 +151,7 @@ class SlackNotificationService(BaseNotificationService): req = requests.get(url, timeout=CONF_TIMEOUT) return req.content - elif local_path is not None: + elif local_path: # Check whether path is whitelisted in configuration.yaml if self.is_allowed_path(local_path): return open(local_path, "rb")