@@ 432,6 432,8 @@ class DHL(Carrier):
result.status_category = StatusCategory.LABEL_CREATED
elif payload['status']['statusCode'] == 'transit':
result.status_category = StatusCategory.IN_TRANSIT
+ elif payload['status']['statusCode'] == 'delivered':
+ result.status_category = StatusCategory.DELIVERED
if 'weight' in payload['details'] and payload['details']['weight'] is not None:
w = payload['details']['weight']
@@ 446,7 448,13 @@ class DHL(Carrier):
if 'location' in event:
if len(event['location']['address']) == 1 and 'addressLocality' in event['location']['address']:
location = event['location']['address']['addressLocality']
- e = PackageEvent(stamp, location, event['status'])
+ if 'status' in event:
+ status = event['status']
+ elif 'description' in event:
+ status = event['description']
+ else:
+ raise ValueError("Event without status or description")
+ e = PackageEvent(stamp, location, status)
result.events.append(e)
if 'origin' in payload and 'address' in payload['origin']: