Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions appdaemon/plugins/hass/hassplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,19 +490,15 @@ async def http_method(
self.logger.error("[%d] HTTP %s: %s %s", cre.status, method.upper(), cre.message, kwargs)
return cre
else:
match resp:
case ClientResponse(
content_type=content_type,
request_info=RequestInfo(url=url, method=str(meth))
):
self.logger.debug("%s success from %s", meth, url)
match content_type:
case "application/json":
return await resp.json()
case "text/plain":
return await resp.text()
case _:
self.logger.warning("Unhandled content type: %s", content_type)
self.logger.debug("%s success from %s", resp.method, resp.url)
match resp.content_type:
case "application/json":
return await resp.json()
case "text/plain":
return await resp.text()
case _:
self.logger.warning("Unhandled content type: %s", resp.content_type)
return None
except asyncio.TimeoutError:
self.logger.error("Timed out waiting for %s", url)
except asyncio.CancelledError:
Expand Down
Loading