Move imports to top for http (#29500)
parent
e9917c6a81
commit
04722fdd63
|
@ -26,7 +26,6 @@ from .real_ip import setup_real_ip
|
|||
from .static import CACHE_HEADERS, CachingStaticResource
|
||||
from .view import HomeAssistantView # noqa: F401
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
DOMAIN = "http"
|
||||
|
|
|
@ -11,7 +11,6 @@ from homeassistant.util import dt as dt_util
|
|||
|
||||
from .const import KEY_AUTHENTICATED, KEY_HASS_USER, KEY_REAL_IP
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -17,7 +17,6 @@ from homeassistant.util.yaml import dump
|
|||
|
||||
from .const import KEY_REAL_IP
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
"""Provide CORS support for the HTTP component."""
|
||||
from aiohttp.hdrs import ACCEPT, AUTHORIZATION, CONTENT_TYPE, ORIGIN
|
||||
from aiohttp.web_urldispatcher import Resource, ResourceRoute, StaticResource
|
||||
from aiohttp.hdrs import ACCEPT, CONTENT_TYPE, ORIGIN, AUTHORIZATION
|
||||
|
||||
from homeassistant.const import HTTP_HEADER_X_REQUESTED_WITH
|
||||
from homeassistant.core import callback
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
ALLOWED_CORS_HEADERS = [
|
||||
|
@ -23,6 +22,7 @@ def setup_cors(app, origins):
|
|||
"""Set up CORS."""
|
||||
# This import should remain here. That way the HTTP integration can always
|
||||
# be imported by other integrations without it's requirements being installed.
|
||||
# pylint: disable=import-outside-toplevel
|
||||
import aiohttp_cors
|
||||
|
||||
cors = aiohttp_cors.setup(
|
||||
|
|
|
@ -4,7 +4,6 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -8,7 +8,6 @@ from homeassistant.core import callback
|
|||
|
||||
from .const import KEY_REAL_IP
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
|
||||
|
|
|
@ -3,10 +3,9 @@ from pathlib import Path
|
|||
|
||||
from aiohttp import hdrs
|
||||
from aiohttp.web import FileResponse
|
||||
from aiohttp.web_exceptions import HTTPNotFound, HTTPForbidden
|
||||
from aiohttp.web_exceptions import HTTPForbidden, HTTPNotFound
|
||||
from aiohttp.web_urldispatcher import StaticResource
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
CACHE_TIME = 31 * 86400 # = 1 month
|
||||
|
|
Loading…
Reference in New Issue