Skip to content

Commit d450731

Browse files
committed
function modified to accept string
1 parent 0bdf888 commit d450731

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

securityhub-forwarder/src/securityhub_forwarder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ def convert_to_utc(timestamp):
4040
#Todo change to convert to RFC3339
4141
try:
4242
if not isinstance(timestamp, int):
43-
ts = timestamp.replace(",", "")
43+
timestamp = timestamp.replace(",", "")
4444
ts = int(timestamp)
45+
else:
46+
ts = timestamp
47+
timestamp = str(timestamp)
4548
ts = ts/1000 if len(timestamp) >= 13 else ts # converting to seconds
4649
utcdate = datetime.utcfromtimestamp(ts).strftime('%Y-%m-%dT%H:%M:%S.%fZ')
4750
except Exception as e:

0 commit comments

Comments
 (0)