#!/usr/bin/env python3 from tracking import Tracking from status import Status from services import get_status def run(): for tracking in Tracking.all(): try: timestamp = Status.from_database(tracking.trackingnumber).timestamp except ValueError: timestamp = None status = get_status(tracking.trackingnumber, tracking.service) if (not timestamp) or timestamp < status.timestamp: status.to_database() status.notify()