From 29a211ac640f57aafc7cd39c9e3979b9b9b4fd11 Mon Sep 17 00:00:00 2001 From: rmarsollier Date: Thu, 9 Mar 2017 15:36:27 +0100 Subject: [PATCH] Using the facilities introduced by MISP commit bdbd0920ba760a514cffdb30cc741b61b589d9da (fix: attachTagToObject and removeTagFromObject now accept posted JSON objects) --- pymisp/api.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index c59fe8f..3013d18 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -378,16 +378,18 @@ class PyMISP(object): if not self._valid_uuid(uuid): raise PyMISPError('Invalid UUID') session = self.__prepare_session() - path = '/tags/attachTagToObject/{}/{}/'.format(uuid, tag) - response = session.post(urljoin(self.root_url, path)) + to_post = {'uuid':uuid, 'tag':tag} + path = 'tags/attachTagToObject' + response = session.post(urljoin(self.root_url, path), data=json.dumps(to_post)) return self._check_response(response) def untag(self, uuid, tag): if not self._valid_uuid(uuid): raise PyMISPError('Invalid UUID') session = self.__prepare_session() - path = '/tags/removeTagFromObject/{}/{}/'.format(uuid, tag) - response = session.post(urljoin(self.root_url, path)) + to_post = {'uuid':uuid, 'tag':tag} + path = 'tags/removeTagFromObject' + response = session.post(urljoin(self.root_url, path), data=json.dumps(to_post)) return self._check_response(response) def add_tag(self, event, tag, attribute=False):