mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix clickatell send_error error check (#57985)
This commit is contained in:
parent
dde8ac4eb5
commit
8e0cb5fcec
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user