Use HTTPStatus instead of HTTP_ consts and magic values in components/a* (#57988)

This commit is contained in:
Ville Skyttä 2021-10-22 15:21:34 +03:00 committed by GitHub
parent 55ffc85a0a
commit a598d9f353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 145 additions and 147 deletions

View file

@ -1,6 +1,7 @@
"""Handle August connection setup and authentication."""
import asyncio
from http import HTTPStatus
import logging
import os
@ -8,12 +9,7 @@ from aiohttp import ClientError, ClientResponseError
from yalexs.api_async import ApiAsync
from yalexs.authenticator_async import AuthenticationState, AuthenticatorAsync
from homeassistant.const import (
CONF_PASSWORD,
CONF_TIMEOUT,
CONF_USERNAME,
HTTP_UNAUTHORIZED,
)
from homeassistant.const import CONF_PASSWORD, CONF_TIMEOUT, CONF_USERNAME
from homeassistant.helpers import aiohttp_client
from .const import (
@ -97,7 +93,7 @@ class AugustGateway:
# by have no access
await self.api.async_get_operable_locks(self.access_token)
except ClientResponseError as ex:
if ex.status == HTTP_UNAUTHORIZED:
if ex.status == HTTPStatus.UNAUTHORIZED:
raise InvalidAuth from ex
raise CannotConnect from ex