From d209780a9da76a55fb0adf3c697a309d97fb5555 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Sun, 4 Feb 2024 11:56:41 -0800 Subject: [PATCH] only add timestamp field if datetime string is parsable --- jc/parsers/http_headers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jc/parsers/http_headers.py b/jc/parsers/http_headers.py index d5ce731e..713ceedc 100644 --- a/jc/parsers/http_headers.py +++ b/jc/parsers/http_headers.py @@ -337,7 +337,9 @@ def _process(proc_data: List[JSONDictType]) -> List[JSONDictType]: item[key] = jc.utils.convert_to_float(item[key]) if key in DT_HEADERS or key in DT_OR_STR_HEADERS: - item[key + '_epoch_utc'] = jc.utils.timestamp(item[key], format_hint=(3500,)).utc + timestamp = jc.utils.timestamp(item[key], format_hint=(3500,)).utc + if timestamp: + item[key + '_epoch_utc'] = timestamp if key in DT_OR_INT_HEADERS: timestamp = jc.utils.timestamp(item[key], format_hint=(3500,)).utc