From 1556c901ef186a786d5279287199d53fde8b5128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 9 Feb 2017 11:59:38 +0100 Subject: [PATCH] Add support for {attach,remove}TagToObject Fix #47 --- pymisp/api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pymisp/api.py b/pymisp/api.py index faedd40..6e7a7f3 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -367,6 +367,18 @@ class PyMISP(object): misp_event = self._prepare_full_event(distribution, threat_level_id, analysis, info, date, published, orgc_id, org_id, sharing_group_id) return self.add_event(json.dumps(misp_event, cls=EncodeUpdate)) + def tag(self, uuid, tag): + session = self.__prepare_session() + path = '/tags/attachTagToObject/{}/{}/'.format(uuid, tag) + response = session.post(urljoin(self.root_url, path)) + return self._check_response(response) + + def untag(self, uuid, tag): + session = self.__prepare_session() + path = '/tags/removeTagFromObject/{}/{}/'.format(uuid, tag) + response = session.post(urljoin(self.root_url, path)) + return self._check_response(response) + def add_tag(self, event, tag, attribute=False): # FIXME: this is dirty, this function needs to be deprecated with something tagging a UUID session = self.__prepare_session()