mirror of
https://github.com/home-assistant/core.git
synced 2025-11-03 16:09:36 +00:00
Improve logging and handling when websocket gets behind (#86854)
fixes undefined
This commit is contained in:
13
homeassistant/components/websocket_api/util.py
Normal file
13
homeassistant/components/websocket_api/util.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""Websocket API util.""."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from aiohttp import web
|
||||
|
||||
|
||||
def describe_request(request: web.Request) -> str:
|
||||
"""Describe a request."""
|
||||
description = f"from {request.remote}"
|
||||
if user_agent := request.headers.get("user-agent"):
|
||||
description += f" ({user_agent})"
|
||||
return description
|
||||
Reference in New Issue
Block a user