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

pull/567/head
VVX7 2020-04-26 14:02:31 -04:00
parent 30f250380a
commit 347950fc68
1 changed files with 9 additions and 3 deletions

View File

@ -200,14 +200,20 @@ class PyMISP:
to_return.append(e)
return to_return
def get_event(self, event: Union[MISPEvent, int, str, UUID], deleted: Union[bool, int, list]=False, pythonify: bool=False) -> Union[dict, MISPEvent]:
def get_event(self, event: Union[MISPEvent, int, str, UUID], deleted: Union[bool, int, list]=False, extended: bool = False, pythonify: bool=False) -> Union[dict, MISPEvent]:
'''Get an event from a MISP instance'''
event_id = self.__get_uuid_or_id_from_abstract_misp(event)
if deleted:
data = {'deleted': deleted}
r = self._prepare_request('POST', f'events/view/{event_id}', data=data)
if extended:
r = self._prepare_request('POST', f'events/view/{event_id}/extended:{event_id}', data=data)
else:
r = self._prepare_request('POST', f'events/view/{event_id}', data=data)
else:
r = self._prepare_request('GET', f'events/view/{event_id}')
if extended:
r = self._prepare_request('GET', f'events/view/{event_id}/extended:{event_id}')
else:
r = self._prepare_request('GET', f'events/view/{event_id}')
event_r = self._check_json_response(r)
if not (self.global_pythonify or pythonify) or 'errors' in event_r:
return event_r