From 129e80e8baa8e233904a79979d826d285ed8a3a9 Mon Sep 17 00:00:00 2001 From: "Schimon Jehudah, Adv." Date: Tue, 15 Oct 2024 22:14:19 +0300 Subject: [PATCH] Python : Fix error KeyError: 'urn:xmpp:microblog:0'. --- fasi.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fasi.py b/fasi.py index c0d1d8e..fc2d147 100644 --- a/fasi.py +++ b/fasi.py @@ -509,12 +509,21 @@ class HttpInstance: # Set node name to 'urn:xmpp:microblog:0' jid_kind = jid_details['kind'] - if jid_kind not in ('conference', 'mix', 'muc') and '@' in jid_bare and not node_name: + nodes = jid_details['nodes'] + if (jid_kind not in ('conference', 'mix', 'muc') and + '@' in jid_bare and + not node_name and + 'urn:xmpp:microblog:0' in nodes): node_name = 'urn:xmpp:microblog:0' + if ('@' in jid_bare and + 'urn:xmpp:microblog:0' not in nodes and + jid_kind not in ('conference', 'mix', 'muc')): + count = 0 + else: + count = nodes[node_name]['count'] if node_name in nodes else jid_details['count'] + action = jid_details['action'] - nodes = jid_details['nodes'] - count = nodes[node_name]['count'] if node_name else jid_details['count'] instance = jid_details['instance'] items = jid_details['items'] jid_info = { @@ -992,6 +1001,7 @@ class Syndication: if (not isinstance(title, ET.Element) and not isinstance(links, ET.Element)): return None title_text = '' if title == None else title.text + link_href = '' if isinstance(links, ET.Element): for link in item_payload.findall(namespace + 'link'): link_href = link.attrib['href'] if 'href' in link.attrib else ''