Use HTTP_OK constant (#33798)
* Use http ok constant * Remove incorrect use * Run isort * Fix pylint by adding missing imports * Fix pylint by fixing one import
This commit is contained in:
parent
7383e81609
commit
8d61893c39
79 changed files with 214 additions and 154 deletions
|
@ -13,6 +13,7 @@ from homeassistant.const import (
|
|||
CONF_MONITORED_VARIABLES,
|
||||
CONF_NAME,
|
||||
DATA_GIGABYTES,
|
||||
HTTP_OK,
|
||||
UNIT_PERCENTAGE,
|
||||
)
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
|
@ -146,7 +147,7 @@ class StartcaData:
|
|||
url = f"https://www.start.ca/support/usage/api?key={self.api_key}"
|
||||
with async_timeout.timeout(REQUEST_TIMEOUT):
|
||||
req = await self.websession.get(url)
|
||||
if req.status != 200:
|
||||
if req.status != HTTP_OK:
|
||||
_LOGGER.error("Request failed with status: %u", req.status)
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue