Skip to content

Commit

Permalink
add error handling for convert_timestamp_to_iso86
Browse files Browse the repository at this point in the history
  • Loading branch information
DeanArbel committed Feb 15, 2024
1 parent a9e3fdc commit 2a45106
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,12 @@ def convert_timestamp_to_iso86(timestamp: str, timezone_letter: str = 'Z') -> st
"""
if not timestamp:
return ''
datetime_from_timestamp = dateparser.parse(timestamp, settings={"TO_TIMEZONE": timezone_letter,
"RETURN_AS_TIMEZONE_AWARE": True})
try:
datetime_from_timestamp = dateparser.parse(str(timestamp), settings={"TO_TIMEZONE": timezone_letter,
"RETURN_AS_TIMEZONE_AWARE": True})
except Exception as e:
demisto.error(f"Encountered issue for {timestamp}. err: {str(e)}")
return ''
assert datetime_from_timestamp is not None, f'{timestamp} could not be parsed'
time_in_iso86 = datetime_from_timestamp.strftime("%Y-%m-%dT%H:%M:%S.%f")
return time_in_iso86[:-3] + timezone_letter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
category: Data Enrichment & Threat Intelligence
category: Data Enrichment & Threat Intelligence (Dev Feb 15th)
commonfields:
id: AlienVault USM Anywhere
id: AlienVault USM Anywhere_dev
version: -1
configuration:
- defaultvalue: https://www.example.com
Expand Down Expand Up @@ -57,7 +57,7 @@ configuration:
required: false
description: Searches for and monitors alarms and events from AlienVault USM Anywhere.
display: AlienVault USM Anywhere
name: AlienVault USM Anywhere
name: AlienVault USM Anywhere_dev
script:
commands:
- arguments:
Expand Down
1 change: 1 addition & 0 deletions Packs/CommonScripts/Scripts/ReadQRCode/ReadQRCode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import demistomock as demisto # noqa
from CommonServerPython import * # noqa
import cv2

# pylint: disable=E1101 # disable pylint not recognizing cv2's attributes.


Expand Down

0 comments on commit 2a45106

Please sign in to comment.