mirror of
https://github.com/soxoj/maigret.git
synced 2026-05-07 06:24:35 +00:00
Fixed dateutil parsing error for CDT timezone (#1907)
This commit is contained in:
+6
-2
@@ -8,6 +8,7 @@ from datetime import datetime
|
|||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
|
|
||||||
import xmind
|
import xmind
|
||||||
|
from dateutil.tz import gettz
|
||||||
from dateutil.parser import parse as parse_datetime_str
|
from dateutil.parser import parse as parse_datetime_str
|
||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
@@ -16,6 +17,8 @@ from .result import QueryStatus
|
|||||||
from .sites import MaigretDatabase
|
from .sites import MaigretDatabase
|
||||||
from .utils import is_country_tag, CaseConverter, enrich_link_str
|
from .utils import is_country_tag, CaseConverter, enrich_link_str
|
||||||
|
|
||||||
|
|
||||||
|
ADDITIONAL_TZINFO = {"CDT": gettz("America/Chicago")}
|
||||||
SUPPORTED_JSON_REPORT_FORMATS = [
|
SUPPORTED_JSON_REPORT_FORMATS = [
|
||||||
"simple",
|
"simple",
|
||||||
"ndjson",
|
"ndjson",
|
||||||
@@ -292,8 +295,8 @@ def generate_report_context(username_results: list):
|
|||||||
first_seen = created_at
|
first_seen = created_at
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
known_time = parse_datetime_str(first_seen)
|
known_time = parse_datetime_str(first_seen, tzinfos=ADDITIONAL_TZINFO)
|
||||||
new_time = parse_datetime_str(created_at)
|
new_time = parse_datetime_str(created_at, tzinfos=ADDITIONAL_TZINFO)
|
||||||
if new_time < known_time:
|
if new_time < known_time:
|
||||||
first_seen = created_at
|
first_seen = created_at
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -302,6 +305,7 @@ def generate_report_context(username_results: list):
|
|||||||
first_seen,
|
first_seen,
|
||||||
created_at,
|
created_at,
|
||||||
str(e),
|
str(e),
|
||||||
|
exc_info=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
for k, v in status.ids_data.items():
|
for k, v in status.ids_data.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user