From 8e0cb5fcec3d00064adff44f14cd6a5e7f06b1f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 19 Oct 2021 23:04:13 +0300 Subject: [PATCH] Fix clickatell send_error error check (#57985) --- homeassistant/components/clickatell/notify.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/clickatell/notify.py b/homeassistant/components/clickatell/notify.py index 09096f44b74..fdefb25aef4 100644 --- a/homeassistant/components/clickatell/notify.py +++ b/homeassistant/components/clickatell/notify.py @@ -1,11 +1,12 @@ """Clickatell platform for notify component.""" +from http import HTTPStatus import logging import requests import voluptuous as vol from homeassistant.components.notify import PLATFORM_SCHEMA, BaseNotificationService -from homeassistant.const import CONF_API_KEY, CONF_RECIPIENT, HTTP_ACCEPTED, HTTP_OK +from homeassistant.const import CONF_API_KEY, CONF_RECIPIENT import homeassistant.helpers.config_validation as cv _LOGGER = logging.getLogger(__name__) @@ -37,5 +38,5 @@ class ClickatellNotificationService(BaseNotificationService): data = {"apiKey": self.api_key, "to": self.recipient, "content": message} resp = requests.get(BASE_API_URL, params=data, timeout=5) - if (resp.status_code != HTTP_OK) or (resp.status_code != HTTP_ACCEPTED): + if resp.status_code not in (HTTPStatus.OK, HTTPStatus.ACCEPTED): _LOGGER.error("Error %s : %s", resp.status_code, resp.text)