Skip to content

Commit 41aca6c

Browse files
author
Jakob Maier
committed
small bufix
1 parent 0bb9b62 commit 41aca6c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

examples/client/get_project_vulnerabilites_as_csv.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'''
2-
Export the vulnerabilites from a project version to CSV. Can be used to apply batch vulnerability
2+
Export the vulnerabilites from a project as CSV. Can be used to apply batch vulnerability
33
remediation with vuln_batch_remediation.py
44
'''
55
from blackduck import Client
@@ -25,6 +25,7 @@ def main():
2525
parser = argparse.ArgumentParser(prog=program_name, usage="%(prog)s [options]", description="Automated Assessment")
2626
parser.add_argument("--output", required=False,help="csv output path" )
2727
parser.add_argument("--project", required=True, help="project name")
28+
parser.add_argument("--base-url", required=False, help="base url", default="https://blackduck.omicron.at")
2829
parser.add_argument("--version", required=False, help="project version, e.g. latest")
2930
parser.add_argument("--component", required=False, help="component name")
3031
args = parser.parse_args()
@@ -39,7 +40,7 @@ def main():
3940

4041
bd = Client(
4142
token=API_TOKEN,
42-
base_url="https://blackduck.omicron.at",
43+
base_url=args.base_url,
4344
verify=False # TLS certificate verification
4445
)
4546

@@ -64,11 +65,7 @@ def main():
6465
name = remediation['vulnerabilityName']
6566
status = remediation['remediationStatus']
6667
description = remediation['description'].replace('\r', '').replace('\n', '')
67-
68-
try:
69-
comment = remediation['remediationComment'].replace('\r', '').replace('\n', '')
70-
except KeyError:
71-
comment = ""
68+
comment = remediation.get('remediationComment', "").replace('\r', '').replace('\n', '')
7269

7370
row = [name, status, comment, componentName, componentVersion, description]
7471
csv_writer.writerow(row)

0 commit comments

Comments
 (0)