Use http.HTTPStatus in components/[gh]* (#58246)

This commit is contained in:
Ville Skyttä 2021-10-23 21:34:53 +03:00 committed by GitHub
parent 583ae3c953
commit b52c5c82b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 272 additions and 247 deletions

View file

@ -1,12 +1,13 @@
"""Support for Habitica sensors."""
from collections import namedtuple
from datetime import timedelta
from http import HTTPStatus
import logging
from aiohttp import ClientResponseError
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import CONF_NAME, HTTP_TOO_MANY_REQUESTS
from homeassistant.const import CONF_NAME
from homeassistant.util import Throttle
from .const import DOMAIN
@ -94,7 +95,7 @@ class HabitipyData:
try:
self.data = await self.api.user.get()
except ClientResponseError as error:
if error.status == HTTP_TOO_MANY_REQUESTS:
if error.status == HTTPStatus.TOO_MANY_REQUESTS:
_LOGGER.warning(
"Sensor data update for %s has too many API requests;"
" Skipping the update",
@ -111,7 +112,7 @@ class HabitipyData:
try:
self.tasks[task_type] = await self.api.tasks.user.get(type=task_type)
except ClientResponseError as error:
if error.status == HTTP_TOO_MANY_REQUESTS:
if error.status == HTTPStatus.TOO_MANY_REQUESTS:
_LOGGER.warning(
"Sensor data update for %s has too many API requests;"
" Skipping the update",