Skip to content

Commit

Permalink
Merge pull request TheHive-Project#63 from billmurrin/pr-add-update-c…
Browse files Browse the repository at this point in the history
…ase-tasks-method

Add Support for update_case_tasks method
  • Loading branch information
nadouani committed Jul 2, 2018
2 parents 057398f + f3daa9c commit 3201788
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions thehive4py/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,27 @@ def create_case_task(self, case_id, case_task):
except requests.exceptions.RequestException as e:
raise CaseTaskException("Case task create error: {}".format(e))

def update_case_task(self, task):
"""
:Updates TheHive Task
:param case: The task to update. The task's `id` determines which Task to update.
:return:
"""
req = self.url + "/api/case/task/{}".format(task.id)

# Choose which attributes to send
update_keys = [
'title', 'description', 'status', 'order', 'user', 'owner', 'flag', 'endDate'
]

data = {k: v for k, v in task.__dict__.items() if k in update_keys}

try:
return requests.patch(req, headers={'Content-Type': 'application/json'}, json=data,
proxies=self.proxies, auth=self.auth, verify=self.cert)
except requests.exceptions.RequestException as e:
raise CaseTaskException("Case task update error: {}".format(e))

def create_task_log(self, task_id, case_task_log):

"""
Expand Down

0 comments on commit 3201788

Please sign in to comment.