Skip to content

Commit

Permalink
Merge pull request #151 from JoeyBarnes/main
Browse files Browse the repository at this point in the history
Updated export-alerts.py to account for alerts without references
  • Loading branch information
judyer28 authored Mar 8, 2024
2 parents 7137b3b + 689be5f commit ec8a091
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tooling/export-alerts/export-alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,15 @@ def addAlertToSheet(alert, ws, headerRow=1):
elif key == 'references':
references = alert['references']
urls = []
for ref in references:
if 'url' in ref:
urls.append(ref['url'])
else:
print ('No URL in reference: ' + ref['name'])

if references:
for ref in references:
if 'url' in ref:
urls.append(ref['url'])
else:
print ('No URL in reference: ' + ref['name'])
else:
print ('No references in alert: ' + alert['name'])

value = '\n'.join(urls)
elif type(alert[key]) is str or type(alert[key]) is int or type(alert[key]) is bool:
Expand Down

0 comments on commit ec8a091

Please sign in to comment.