chg: Allow to hard delete an attribute by ID.

pull/124/head
Raphaël Vinot 2017-10-22 14:02:47 -04:00
parent a63d53094f
commit 4c4cd23983
1 changed files with 6 additions and 3 deletions

View File

@ -360,11 +360,14 @@ class PyMISP(object):
response = session.delete(url)
return self._check_response(response)
def delete_attribute(self, attribute_id):
def delete_attribute(self, attribute_id, hard_delete=False):
"""Delete an attribute by ID"""
session = self.__prepare_session()
url = urljoin(self.root_url, 'attributes/{}'.format(attribute_id))
response = session.delete(url)
if hard_delete:
url = urljoin(self.root_url, 'attributes/delete/{}/1'.format(attribute_id))
else:
url = urljoin(self.root_url, 'attributes/delete/{}'.format(attribute_id))
response = session.get(url)
return self._check_response(response)
def pushEventToZMQ(self, event_id):