From 963ddba40bd4925ea4de97a7b5ddb079257f495d Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Fri, 16 Nov 2018 11:02:32 +0100 Subject: [PATCH 1/2] #93 make case status un updatable field --- .gitignore | 2 +- samples/test-case-update.py | 6 +++--- thehive4py/api.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c6cc9ad7..63109d6d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ .cache/ .idea/ .vscode/ -venv/ +venv*/ tmp/ *.pyc thehive4py/*.pyc diff --git a/samples/test-case-update.py b/samples/test-case-update.py index 9e084c57..1ec3af77 100644 --- a/samples/test-case-update.py +++ b/samples/test-case-update.py @@ -7,7 +7,7 @@ api = TheHiveApi('http://127.0.0.1:9000', '**YOUR_API_KEY**') # Create a new case -case = thehive.case.create(title='From TheHive4Py', description='N/A', tlp=3, flag=True, +case = api.case.create(title='From TheHive4Py', description='N/A', tlp=3, flag=True, tags=['TheHive4Py', 'sample'], tasks=[]) # Save the new case's ID for later use @@ -19,8 +19,8 @@ case.flag = False # Update the case -thehive.update_case(case) +api.update_case(case) # Retrieve the case from the server and check the updated values -new_case = thehive.case(case_id) +new_case = api.case(case_id) print("Case ID {}\nTLP: {}, Severity: {}".format(new_case.id, new_case.tlp, new_case.severity)) \ No newline at end of file diff --git a/thehive4py/api.py b/thehive4py/api.py index d60139ff..04cb6e6d 100644 --- a/thehive4py/api.py +++ b/thehive4py/api.py @@ -114,7 +114,7 @@ def update_case(self, case, fields=[]): # Choose which attributes to send update_keys = [ - 'title', 'description', 'severity', 'startDate', 'owner', 'flag', 'tlp', 'tags', 'resolutionStatus', + 'title', 'description', 'severity', 'startDate', 'owner', 'flag', 'tlp', 'tags', 'status', 'resolutionStatus', 'impactStatus', 'summary', 'endDate', 'metrics', 'customFields' ] data = {k: v for k, v in case.__dict__.items() if (len(fields) > 0 and k in fields) or (len(fields) == 0 and k in update_keys)} From 92bc8902aab4c3108f3ebd2bb57cf6122d86f8ff Mon Sep 17 00:00:00 2001 From: Nabil Adouani Date: Fri, 16 Nov 2018 11:07:13 +0100 Subject: [PATCH 2/2] Bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index cafaab13..5b156bb3 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name='thehive4py', - version='1.5.2', + version='1.5.3', description='Python API client for TheHive.', long_description=read_md('README.md'), author='TheHive-Project',