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 typing import List
import pandas as pd
import dateparser
import pytz
from checker import nagios
@ -77,10 +77,7 @@ def main(args):
metadata = smart_health['metadata']
# For testing
# 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')
last_updated = dateparser.parse(smart_health['data']['device']['UpdatedAt'])
if datetime.now(pytz.utc) - timedelta(hours=args.time_delta_limit) > last_updated.replace(tzinfo=pytz.utc):
metrics_out_of_date = True

View File

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