Skip to content

Commit 4c9434b

Browse files
authored
Update json.py
1 parent fa2ef7e commit 4c9434b

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

pyt/formatters/json.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,17 @@ def report(
1010
):
1111
"""
1212
Prints issues in JSON format.
13-
1413
Args:
1514
vulnerabilities: list of vulnerabilities to report
1615
fileobj: The output file object, which may be sys.stdout
1716
"""
1817
TZ_AGNOSTIC_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
1918
time_string = datetime.utcnow().strftime(TZ_AGNOSTIC_FORMAT)
20-
try:
21-
machine_output = {
22-
'generated_at': time_string,
23-
'vulnerabilities': [vuln.as_dict() for vuln in vulnerabilities]
24-
}
25-
except:
26-
machine_output = {
27-
'generated_at': time_string,
28-
'vulnerabilities': [vuln for vuln in vulnerabilities]
29-
}
19+
20+
machine_output = {
21+
'generated_at': time_string,
22+
'vulnerabilities': [vuln.as_dict() for vuln in vulnerabilities]
23+
}
3024

3125
result = json.dumps(
3226
machine_output,

0 commit comments

Comments
 (0)