Skip to content

Commit

Permalink
Replace homeassistant HTTP constants with http.HTTPStatus (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
marbindrakon authored Nov 27, 2021
1 parent 193172e commit ce544b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/auth_header/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from http import HTTPStatus
from ipaddress import ip_address
from typing import OrderedDict
from aiohttp.web_request import Request
@@ -14,7 +15,6 @@
)
from homeassistant.components.http.ban import log_invalid_auth, process_success_login
from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.const import HTTP_BAD_REQUEST, HTTP_NOT_FOUND
from homeassistant.core import HomeAssistant

from . import headers
@@ -100,7 +100,7 @@ async def post(self, request: Request, data):
request.app["hass"], data["client_id"], data["redirect_uri"]
):
return self.json_message(
"invalid client id or redirect uri", HTTP_BAD_REQUEST
"invalid client id or redirect uri", HTTPStatus.BAD_REQUEST
)

if isinstance(data["handler"], list):
@@ -121,9 +121,9 @@ async def post(self, request: Request, data):
},
)
except data_entry_flow.UnknownHandler:
return self.json_message("Invalid handler specified", HTTP_NOT_FOUND)
return self.json_message("Invalid handler specified", HTTPStatus.NOT_FOUND)
except data_entry_flow.UnknownStep:
return self.json_message("Handler does not support init", HTTP_BAD_REQUEST)
return self.json_message("Handler does not support init", HTTPStatus.BAD_REQUEST)

if result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY:
await process_success_login(request)

0 comments on commit ce544b2

Please sign in to comment.