Add support for {attach,remove}TagToObject

Fix #47
pull/51/head
Raphaël Vinot 2017-02-09 11:59:38 +01:00
parent 6b5f347423
commit 1556c901ef
1 changed files with 12 additions and 0 deletions

View File

@ -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) 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)) 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): def add_tag(self, event, tag, attribute=False):
# FIXME: this is dirty, this function needs to be deprecated with something tagging a UUID # FIXME: this is dirty, this function needs to be deprecated with something tagging a UUID
session = self.__prepare_session() session = self.__prepare_session()