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
@@ -14,6 +14,7 @@ from homeassistant.const import (
|
||||
CONF_CLIENT_ID,
|
||||
CONF_CLIENT_SECRET,
|
||||
HTTP_FORBIDDEN,
|
||||
HTTP_UNAUTHORIZED,
|
||||
)
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
@@ -158,7 +159,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
|
||||
hass.data[DOMAIN][DATA_BROKERS][entry.entry_id] = broker
|
||||
|
||||
except ClientResponseError as ex:
|
||||
if ex.status in (401, HTTP_FORBIDDEN):
|
||||
if ex.status in (HTTP_UNAUTHORIZED, HTTP_FORBIDDEN):
|
||||
_LOGGER.exception(
|
||||
"Unable to setup configuration entry '%s' - please reconfigure the integration",
|
||||
entry.title,
|
||||
|
||||
Reference in new issue
Block a user