mirror of
https://github.com/home-assistant/core.git
synced 2025-11-13 04:50:17 +00:00
Use KEY_HASS [a-g] (#112609)
This commit is contained in:
@@ -25,7 +25,7 @@ from homeassistant.components.alexa import (
|
||||
)
|
||||
from homeassistant.components.google_assistant import helpers as google_helpers
|
||||
from homeassistant.components.homeassistant import exposed_entities
|
||||
from homeassistant.components.http import HomeAssistantView, require_admin
|
||||
from homeassistant.components.http import KEY_HASS, HomeAssistantView, require_admin
|
||||
from homeassistant.components.http.data_validator import RequestDataValidator
|
||||
from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
@@ -197,7 +197,7 @@ class GoogleActionsSyncView(HomeAssistantView):
|
||||
@_handle_cloud_errors
|
||||
async def post(self, request: web.Request) -> web.Response:
|
||||
"""Trigger a Google Actions sync."""
|
||||
hass = request.app["hass"]
|
||||
hass = request.app[KEY_HASS]
|
||||
cloud: Cloud[CloudClient] = hass.data[DOMAIN]
|
||||
gconf = await cloud.client.get_google_config()
|
||||
status = await gconf.async_sync_entities(gconf.agent_user_id)
|
||||
@@ -217,7 +217,7 @@ class CloudLoginView(HomeAssistantView):
|
||||
)
|
||||
async def post(self, request: web.Request, data: dict[str, Any]) -> web.Response:
|
||||
"""Handle login request."""
|
||||
hass: HomeAssistant = request.app["hass"]
|
||||
hass = request.app[KEY_HASS]
|
||||
cloud: Cloud[CloudClient] = hass.data[DOMAIN]
|
||||
await cloud.login(data["email"], data["password"])
|
||||
|
||||
@@ -235,7 +235,7 @@ class CloudLogoutView(HomeAssistantView):
|
||||
@_handle_cloud_errors
|
||||
async def post(self, request: web.Request) -> web.Response:
|
||||
"""Handle logout request."""
|
||||
hass = request.app["hass"]
|
||||
hass = request.app[KEY_HASS]
|
||||
cloud: Cloud[CloudClient] = hass.data[DOMAIN]
|
||||
|
||||
async with asyncio.timeout(REQUEST_TIMEOUT):
|
||||
@@ -262,7 +262,7 @@ class CloudRegisterView(HomeAssistantView):
|
||||
)
|
||||
async def post(self, request: web.Request, data: dict[str, Any]) -> web.Response:
|
||||
"""Handle registration request."""
|
||||
hass = request.app["hass"]
|
||||
hass = request.app[KEY_HASS]
|
||||
cloud: Cloud[CloudClient] = hass.data[DOMAIN]
|
||||
|
||||
client_metadata = None
|
||||
@@ -299,7 +299,7 @@ class CloudResendConfirmView(HomeAssistantView):
|
||||
@RequestDataValidator(vol.Schema({vol.Required("email"): str}))
|
||||
async def post(self, request: web.Request, data: dict[str, Any]) -> web.Response:
|
||||
"""Handle resending confirm email code request."""
|
||||
hass = request.app["hass"]
|
||||
hass = request.app[KEY_HASS]
|
||||
cloud: Cloud[CloudClient] = hass.data[DOMAIN]
|
||||
|
||||
async with asyncio.timeout(REQUEST_TIMEOUT):
|
||||
@@ -319,7 +319,7 @@ class CloudForgotPasswordView(HomeAssistantView):
|
||||
@RequestDataValidator(vol.Schema({vol.Required("email"): str}))
|
||||
async def post(self, request: web.Request, data: dict[str, Any]) -> web.Response:
|
||||
"""Handle forgot password request."""
|
||||
hass = request.app["hass"]
|
||||
hass = request.app[KEY_HASS]
|
||||
cloud: Cloud[CloudClient] = hass.data[DOMAIN]
|
||||
|
||||
async with asyncio.timeout(REQUEST_TIMEOUT):
|
||||
|
||||
Reference in New Issue
Block a user