mirror of https://github.com/MISP/PyMISP
Simplfy MISPEvent.add_attribute
parent
481c8e4790
commit
9fc631cc85
|
@ -593,11 +593,11 @@ class MISPEvent(object):
|
||||||
if not found:
|
if not found:
|
||||||
raise Exception('No attribute with UUID/ID {} found.'.format(attribute_id))
|
raise Exception('No attribute with UUID/ID {} found.'.format(attribute_id))
|
||||||
|
|
||||||
def add_attribute(self, type_, value, **kwargs):
|
def add_attribute(self, type, value, **kwargs):
|
||||||
attribute = MISPAttribute(self.describe_types)
|
attribute = MISPAttribute(self.describe_types)
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
for a in value:
|
for a in value:
|
||||||
self.add_attribute(type_, a, **kwargs)
|
self.add_attribute(type, a, **kwargs)
|
||||||
else:
|
else:
|
||||||
attribute.set_all_values(type=type_, value=value, **kwargs)
|
attribute.set_all_values(type=type, value=value, **kwargs)
|
||||||
self.attributes.append(attribute)
|
self.attributes.append(attribute)
|
||||||
|
|
Loading…
Reference in New Issue