From 8af33496ee6ffa4c0ac268206ee476c5ddf5d12f Mon Sep 17 00:00:00 2001 From: Thomas Freudenberg Date: Wed, 8 Dec 2021 08:16:26 +0100 Subject: [PATCH] adopts removal of hass.const.HTTP_* --- custom_components/ha_strava/__init__.py | 8 ++++---- custom_components/ha_strava/config_flow.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/ha_strava/__init__.py b/custom_components/ha_strava/__init__.py index 3d605b2..d766852 100644 --- a/custom_components/ha_strava/__init__.py +++ b/custom_components/ha_strava/__init__.py @@ -9,6 +9,7 @@ from aiohttp import ClientSession from aiohttp.web import json_response, Response, Request from datetime import datetime as dt +from http import HTTPStatus # HASS imports from homeassistant import data_entry_flow @@ -20,7 +21,6 @@ from homeassistant.const import ( CONF_CLIENT_ID, CONF_CLIENT_SECRET, - HTTP_OK, CONF_WEBHOOK_ID, EVENT_COMPONENT_LOADED, EVENT_CORE_CONFIG_UPDATE, @@ -365,10 +365,10 @@ async def get(self, request): webhook_subscription_challenge = request.query.get("hub.challenge", None) if webhook_subscription_challenge: return json_response( - status=HTTP_OK, data={"hub.challenge": webhook_subscription_challenge} + status=HTTPStatus.OK, data={"hub.challenge": webhook_subscription_challenge} ) - return Response(status=HTTP_OK) + return Response(status=HTTPStatus.OK) async def post(self, request: Request): """Handle incoming post request""" @@ -388,7 +388,7 @@ async def post(self, request: Request): self.hass.async_create_task(self.fetch_strava_data()) # always return a 200 response - return Response(status=HTTP_OK) + return Response(status=HTTPStatus.OK) async def renew_webhook_subscription( diff --git a/custom_components/ha_strava/config_flow.py b/custom_components/ha_strava/config_flow.py index 1f66080..646351f 100644 --- a/custom_components/ha_strava/config_flow.py +++ b/custom_components/ha_strava/config_flow.py @@ -8,7 +8,7 @@ # HASS imports from homeassistant import config_entries -from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET, HTTP_OK +from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET from homeassistant.core import callback from homeassistant.helpers import config_entry_oauth2_flow, config_validation as cv from homeassistant.helpers.network import get_url, NoURLAvailableError