replace pandas with dateparser

This commit is contained in:
Cyberes 2024-02-04 13:29:58 -07:00
parent 08be6c0950
commit d8a20a038f
2 changed files with 3 additions and 6 deletions

View File

@ -5,7 +5,7 @@ import sys
from datetime import datetime, timedelta from datetime import datetime, timedelta
from typing import List from typing import List
import pandas as pd import dateparser
import pytz import pytz
from checker import nagios from checker import nagios
@ -77,10 +77,7 @@ def main(args):
metadata = smart_health['metadata'] metadata = smart_health['metadata']
# For testing last_updated = dateparser.parse(smart_health['data']['device']['UpdatedAt'])
# smart_health['data']['device']['UpdatedAt'] = '2023-04-28T23:00:03.071184465Z'
last_updated = pd.to_datetime(smart_health['data']['device']['UpdatedAt']) # , '%Y-%m-%dT%H:%M:%S.%fZ')
if datetime.now(pytz.utc) - timedelta(hours=args.time_delta_limit) > last_updated.replace(tzinfo=pytz.utc): if datetime.now(pytz.utc) - timedelta(hours=args.time_delta_limit) > last_updated.replace(tzinfo=pytz.utc):
metrics_out_of_date = True metrics_out_of_date = True

View File

@ -6,8 +6,8 @@ numpy==1.24.4
requests==2.31.0 requests==2.31.0
pillow==9.4.0 pillow==9.4.0
beautifulsoup4==4.11.2 beautifulsoup4==4.11.2
pandas==2.0.0
pytz==2023.3.post1 pytz==2023.3.post1
cf_speedtest==0.1.7 cf_speedtest==0.1.7
zfslib==0.11.0 zfslib==0.11.0
hurry.filesize==0.9 hurry.filesize==0.9
dateparser==1.2.0