Use HTTP_BAD_REQUEST constant (#33797)

This commit is contained in:
springstan 2020-04-09 21:43:42 +02:00 committed by GitHub
parent d510384c0d
commit 4c38e6cfa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 111 additions and 61 deletions

View file

@ -10,6 +10,7 @@ from aiohttp.web_exceptions import HTTPForbidden, HTTPUnauthorized
import voluptuous as vol
from homeassistant.config import load_yaml_config_file
from homeassistant.const import HTTP_BAD_REQUEST
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
import homeassistant.helpers.config_validation as cv
@ -81,7 +82,7 @@ def log_invalid_auth(func):
async def handle_req(view, request, *args, **kwargs):
"""Try to log failed login attempts if response status >= 400."""
resp = await func(view, request, *args, **kwargs)
if resp.status >= 400:
if resp.status >= HTTP_BAD_REQUEST:
await process_wrong_login(request)
return resp