new: [dev] add flag to get extended misp event

pull/567/head
VVX7 2020-04-26 14:01:28 -04:00
parent 5a78b63d9b
commit 30f250380a
1 changed files with 11 additions and 0 deletions

View File

@ -239,6 +239,17 @@ class PyMISP:
e.load(updated_event) e.load(updated_event)
return e return e
def extend_event(self, event: MISPEvent, event_id: int, pythonify: bool=False) -> Union[dict, MISPEvent]:
'''Extends an event on a MISP instance'''
eid = self.__get_uuid_or_id_from_abstract_misp(event_id)
r = self._prepare_request('POST', f'events/add/extends/{eid}', data=event)
updated_event = self._check_json_response(r)
if not (self.global_pythonify or pythonify) or 'errors' in updated_event:
return updated_event
e = MISPEvent()
e.load(updated_event)
return e
def delete_event(self, event: Union[MISPEvent, int, str, UUID]) -> dict: def delete_event(self, event: Union[MISPEvent, int, str, UUID]) -> dict:
'''Delete an event from a MISP instance''' '''Delete an event from a MISP instance'''
event_id = self.__get_uuid_or_id_from_abstract_misp(event) event_id = self.__get_uuid_or_id_from_abstract_misp(event)