scrap pytz

This commit is contained in:
burnettk 2024-07-30 14:25:28 -04:00
parent 56efd4c8c4
commit 6305673729
No known key found for this signature in database
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
from datetime import datetime from datetime import datetime
import pytz from datetime import timezone
import json import json
import os, os.path import os, os.path
import socket import socket
@ -48,7 +48,7 @@ def send_event(event):
timestamp_value = event['timestamp'] timestamp_value = event['timestamp']
# if timestamp is an integer or a float (any numeric type), convert to a iso8601 string so that elastic will index it as a date # if timestamp is an integer or a float (any numeric type), convert to a iso8601 string so that elastic will index it as a date
if isinstance(timestamp_value, (int, float)): if isinstance(timestamp_value, (int, float)):
utc_time = datetime.fromtimestamp(timestamp_value, tz=pytz.UTC) utc_time = datetime.fromtimestamp(timestamp_value, tz=timezone.utc)
event['timestamp'] = utc_time.isoformat() event['timestamp'] = utc_time.isoformat()
try: try: