Fix clickatell send_error error check (#57985)

This commit is contained in:
Ville Skyttä 2021-10-19 23:04:13 +03:00 committed by GitHub
parent dde8ac4eb5
commit 8e0cb5fcec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)