mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Improve type hints for webhook implementation in dialogflow (#121592)
This commit is contained in:
parent
a1fae0e0ce
commit
7aada39b77
@ -28,7 +28,9 @@ class DialogFlowError(HomeAssistantError):
|
|||||||
"""Raised when a DialogFlow error happens."""
|
"""Raised when a DialogFlow error happens."""
|
||||||
|
|
||||||
|
|
||||||
async def handle_webhook(hass, webhook_id, request):
|
async def handle_webhook(
|
||||||
|
hass: HomeAssistant, webhook_id: str, request: web.Request
|
||||||
|
) -> web.Response | None:
|
||||||
"""Handle incoming webhook with Dialogflow requests."""
|
"""Handle incoming webhook with Dialogflow requests."""
|
||||||
message = await request.json()
|
message = await request.json()
|
||||||
|
|
||||||
@ -36,7 +38,7 @@ async def handle_webhook(hass, webhook_id, request):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
response = await async_handle_message(hass, message)
|
response = await async_handle_message(hass, message)
|
||||||
return b"" if response is None else web.json_response(response)
|
return None if response is None else web.json_response(response)
|
||||||
|
|
||||||
except DialogFlowError as err:
|
except DialogFlowError as err:
|
||||||
_LOGGER.warning(str(err))
|
_LOGGER.warning(str(err))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user