From d8a20a038f4ebc375750324b62231fb309dbe868 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 4 Feb 2024 13:29:58 -0700 Subject: [PATCH] replace pandas with dateparser --- check_scrutiny_disks.py | 7 ++----- requirements-everybody.txt | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/check_scrutiny_disks.py b/check_scrutiny_disks.py index f3c83ee..dccadb4 100755 --- a/check_scrutiny_disks.py +++ b/check_scrutiny_disks.py @@ -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 diff --git a/requirements-everybody.txt b/requirements-everybody.txt index c1cb957..dbd27d2 100644 --- a/requirements-everybody.txt +++ b/requirements-everybody.txt @@ -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 \ No newline at end of file