diff --git a/pymisp/api.py b/pymisp/api.py index 80e5836..1c301e8 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -600,7 +600,7 @@ class PyMISP: and new_attribute['errors'][1]['message'] == 'You do not have permission to do that.'): # At this point, we assume the user tried to add an attribute on an event they don't own # Re-try with a proposal - if isinstance(attribute, MISPAttribute): + if isinstance(attribute, (MISPAttribute, dict)): return self.add_attribute_proposal(event_id, attribute, pythonify) if not (self.global_pythonify or pythonify) or 'errors' in new_attribute: return new_attribute diff --git a/tests/testlive_comprehensive.py b/tests/testlive_comprehensive.py index 039802d..72cdb2e 100644 --- a/tests/testlive_comprehensive.py +++ b/tests/testlive_comprehensive.py @@ -1740,7 +1740,7 @@ class TestComprehensive(unittest.TestCase): self.assertTrue(isinstance(attribute, MISPShadowAttribute), attribute) # Test if add proposal without category works - https://github.com/MISP/MISP/issues/4868 attribute = self.user_misp_connector.add_attribute(second.id, {'type': 'ip-dst', 'value': '123.43.32.22'}) - self.assertTrue(isinstance(attribute, MISPShadowAttribute)) + self.assertTrue(isinstance(attribute, MISPShadowAttribute), attribute) # Add attribute with the same value as an existing proposal prop_attr.uuid = str(uuid4()) attribute = self.admin_misp_connector.add_attribute(second, prop_attr, pythonify=True)