Use http status constants more, add HTTP_ACCEPTED and HTTP_BAD_GATEWAY (#39993)
* Use http status codes and add HTTP_BAD_GATEWAY constant * Address review comments: - using constants in tado integration - using constant in media_player init.py * Add and use HTTP_ACCEPTED constant
This commit is contained in:
1 parent
59d610af17
commit
db582bdc1b
32 files changed
+137
-58
No files matched your search
@@ -8,7 +8,7 @@ import async_timeout
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import CONTENT_TYPE_JSON, HTTP_NOT_FOUND
|
||||
from homeassistant.const import CONTENT_TYPE_JSON, HTTP_NOT_FOUND, HTTP_UNAUTHORIZED
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
@@ -135,7 +135,7 @@ class TtnDataStorage:
|
||||
_LOGGER.error("The device is not available: %s", self._device_id)
|
||||
return None
|
||||
|
||||
if status == 401:
|
||||
if status == HTTP_UNAUTHORIZED:
|
||||
_LOGGER.error("Not authorized for Application ID: %s", self._app_id)
|
||||
return None
|
||||
|
||||
|
||||
Reference in new issue
Block a user