Use KEY_HASS [a-g] (#112609)

This commit is contained in:
Marc Mueller 2024-03-07 18:09:20 +01:00 committed by GitHub
parent 8ca127df2a
commit f3594c543d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 67 additions and 68 deletions

View file

@ -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):