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 2019-03-05 17:22:21 +00:00 committed by Paulus Schoutsen
parent 7d9c14541b
commit 401720085d

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)