From a74b3a9fdfce31c6229da4e2a1f02ef2445acd62 Mon Sep 17 00:00:00 2001 From: Shocker Date: Thu, 11 Dec 2025 10:54:41 +0200 Subject: [PATCH] Fix CSS / Beautiful Soup parsing --- custom_components/http_agent/coordinator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_components/http_agent/coordinator.py b/custom_components/http_agent/coordinator.py index dd108f1..f881539 100644 --- a/custom_components/http_agent/coordinator.py +++ b/custom_components/http_agent/coordinator.py @@ -61,12 +61,16 @@ def __init__(self, text: str, status: int, headers: dict): except (json.JSONDecodeError, TypeError): self.json = None - # Parse as XML/HTML + # Parse as HTML / Soup try: self.soup = BeautifulSoup(text, "lxml") - self.xml = ET.fromstring(text) except Exception: self.soup = None + + # Parse as XML/HTML + try: + self.xml = ET.fromstring(text) + except Exception: self.xml = None