From b39121c388ca6b83a2b32977866f395e480e77cf Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Wed, 14 Aug 2013 22:14:55 +0200 Subject: tracking: Ignore fedex events with missing date or time. --- modules/tracking.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules') diff --git a/modules/tracking.py b/modules/tracking.py index 1d6a5f7..7cf601f 100644 --- a/modules/tracking.py +++ b/modules/tracking.py @@ -183,6 +183,9 @@ class FedexModule(TrackingModule): results = [] for package in packages: lastevent = package['scanEventList'][0] + # Ignore events with missing date or time, this seems to be a temporary thing. + if not lastevent['date'] or not lastevent['time']: + continue date = datetime.datetime.strptime('%s %s' % (lastevent['date'], lastevent['time']), '%Y-%m-%d %H:%M:%S') if lastevent['gmtOffset']: tz = pytz.timezone('Etc/GMT' + ('+' if lastevent['gmtOffset'][0] == '-' else '-') + str(int(lastevent['gmtOffset'][1:3]))) -- cgit v1.2.3