Read the panel SSE body from response.content (task 4cbf2e96) (#295)
Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #295.
This commit is contained in:
@@ -315,7 +315,10 @@ class NestQuestApiClient:
|
||||
event_type: str | None = None
|
||||
data_lines: list[str] = []
|
||||
buffer = ""
|
||||
async for chunk in response:
|
||||
# The body is ``response.content`` (aiohttp's StreamReader,
|
||||
# yielding bytes); the response object itself — HA's
|
||||
# ``HassClientResponse`` included — is NOT async-iterable.
|
||||
async for chunk in response.content:
|
||||
if isinstance(chunk, (bytes, bytearray)):
|
||||
chunk = chunk.decode("utf-8")
|
||||
buffer += chunk
|
||||
|
||||
Reference in New Issue
Block a user