From 6e2756741bd0650f3de9ec13f71f1daa299c71ab Mon Sep 17 00:00:00 2001 From: Devin Matte Date: Thu, 28 Mar 2024 20:28:49 -0400 Subject: [PATCH] fix: Fixing parsing to use full datetime (#48) * Fixing parsing to use full datetime * Ensuring date check is the same * Go back to just using date.today --- slowzones.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slowzones.py b/slowzones.py index 68e1045..3f0ebfd 100644 --- a/slowzones.py +++ b/slowzones.py @@ -3,7 +3,7 @@ import requests import logging import argparse -from datetime import timedelta, date +from datetime import datetime, timedelta, date from domains.mastodon import send_fixed_slow_zone_toots, send_new_slow_zone_toots, send_updated_slow_zone_toots from domains.twitter import send_fixed_slow_zone_tweets, send_new_slow_zone_tweets, send_updated_slow_zone_tweets from domains.slack import send_fixed_slow_zone_slacks, send_new_slow_zone_slacks, send_updated_slow_zone_slacks @@ -46,9 +46,9 @@ def main(): slow_zones = requests.get("https://dashboard.transitmatters.org/static/slowzones/all_slow.json") - if date.fromisoformat(slow_zones.json()["updated_on"]) != date.today(): + if datetime.fromisoformat(slow_zones.json()["updated_on"]).date() != date.today(): logging.error("Slow zone data was not updated yet today") - # exit if no issues + # exit if issues sys.exit(1) slow_zones_data = slow_zones.json()["data"]