Fix call deflection update in Fritz!Tools (#92267)

fix
This commit is contained in:
Michael 2023-04-30 02:19:41 +02:00 committed by GitHub
parent e2636587f8
commit 895c0be82c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -385,11 +385,12 @@ class FritzBoxTools(
if not raw_data: if not raw_data:
return {} return {}
items = xmltodict.parse(raw_data["NewDeflectionList"])["List"]["Item"] xml_data = xmltodict.parse(raw_data["NewDeflectionList"])
if xml_data.get("List") and (items := xml_data["List"].get("Item")) is not None:
if not isinstance(items, list): if not isinstance(items, list):
items = [items] items = [items]
return {int(item["DeflectionId"]): item for item in items} return {int(item["DeflectionId"]): item for item in items}
return {}
async def _async_get_wan_access(self, ip_address: str) -> bool | None: async def _async_get_wan_access(self, ip_address: str) -> bool | None:
"""Get WAN access rule for given IP address.""" """Get WAN access rule for given IP address."""