From 0fc0e3c8cffce88f32b548f3e678a3909d0bb02b Mon Sep 17 00:00:00 2001 From: Mahdi Date: Sat, 25 Jul 2026 10:34:45 +0330 Subject: [PATCH] prevent unnecessary keyError in add_attribute --- pymisp/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pymisp/api.py b/pymisp/api.py index ef3dd3d8..53792a71 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -1073,7 +1073,7 @@ def add_attribute(self, event: MISPEvent | int | str | UUID, attribute: MISPAttr a.from_dict(**new_attribute['Attribute']) to_return['attributes'].append(a) else: - for new_attr in new_attribute['Attribute']: + for new_attr in new_attribute.get('Attribute', []): a = MISPAttribute() a.from_dict(**new_attr) to_return['attributes'].append(a)