Merge pull request #56 from rmarsollier/master

throw exception for invalid uuid
pull/60/head
Raphaël Vinot 2017-03-08 18:04:44 +01:00 committed by GitHub
commit c2ef188e37
1 changed files with 4 additions and 0 deletions

View File

@ -375,12 +375,16 @@ class PyMISP(object):
return self.add_event(json.dumps(misp_event, cls=EncodeUpdate))
def tag(self, uuid, tag):
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))
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))