Allow 202 status code as a successful REST notify response (#21678)

The REST notification component only allows 200 + 201 as a successful
response code to the submission. notify.me returns a 202 (Accepted)
response, which works fine but gets logged as a warning in the log.
Update the allowed statuses to treat the 202 as ok.
This commit is contained in:
Jonathan McDowell authored and Paulus Schoutsen committed 2019-03-05 09:22:21 -08:00
1 parent 7d9c14541b
commit 401720085d
1 file changed
+1 -1
+1 -1
View File
@@ -112,7 +112,7 @@ class RestNotificationService(BaseNotificationService):
response = requests.get(self._resource, headers=self._headers,
params=data, timeout=10)
if response.status_code not in (200, 201):
if response.status_code not in (200, 201, 202):
_LOGGER.exception(
"Error sending message. Response %d: %s:",
response.status_code, response.reason)