From 347950fc68449a2a3a85e8a920558bf7ff73fb97 Mon Sep 17 00:00:00 2001 From: VVX7 Date: Sun, 26 Apr 2020 14:02:31 -0400 Subject: [PATCH] new: [dev] add flag to get extended misp event --- pymisp/api.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index 453410a..cd5ff93 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -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