Skip to content

Commit

Permalink
Add delete_case function
Browse files Browse the repository at this point in the history
  • Loading branch information
jojoob committed Nov 21, 2018
1 parent 09c263e commit 37c12b1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions thehive4py/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,20 @@ def get_case(self, case_id):
def find_cases(self, **attributes):
return self.__find_rows("/api/case/_search", **attributes)

def delete_case(self, case_id, force=False):
"""
Deletes a TheHive case. Unless force is set to True the case is 'soft deleted' (status set to deleted).
:param case_id: Case identifier
:return: A requests response object.
"""
req = self.url + "/api/case/{}".format(case_id)
if force:
req += '/force'
try:
return requests.delete(req, proxies=self.proxies, auth=self.auth, verify=self.cert)
except requests.exceptions.RequestException as e:
raise CaseException("Case deletion error: {}".format(e))

def find_first(self, **attributes):
"""
:return: first case of result set given by query
Expand Down

0 comments on commit 37c12b1

Please sign in to comment.