Get packages.

def get_packages(session):
    """Get packages."""
    resp = session.post(TRACKING_URL, {
        'data': json.dumps(SHIPMENT_LIST_REQUEST),
        'action': SHIPMENT_LIST_ACTION,
        'format': SHIPMENT_LIST_FORMAT,
        'locale': session.auth.locale,
        'version': 1
    })
    data = resp.json().get('ShipmentListLightResponse')
    if not data.get('successful'):
        err = 'failed to get shipment list: {}'.format(data.get('errorList')[0]
                                                       .get('message'))
        raise FedexError(err)
    packages = []
    for package in data.get('shipmentLightList'):
        if 'trkNbr' not in package or not package['trkNbr']:
            continue
        if 'isOut' in package and package['isOut'] == '1':
            continue
        packages.append({
            'weight': package['dispPkgLbsWgt'],
            'dimensions': package['pkgDimIn'],
            'tracking_number': package['trkNbr'],
            'from': package['shpBy'],
            'shipped_from': '{} {} {} {}'.format(package['shprAddr1'], package['shprCity'],
                                                 package['shprStCD'], package['shprCntryCD']),
            'primary_status': package['keyStat'],
            'secondary_status': package['mainStat'],
            'estimated_delivery_date': (str(parse(package['estDelTs']).date())
                                        if package['estDelTs'] else ''),
            'delivery_date': str(parse(package['delTs']).date()) if package['delTs'] else ''
        })
    return packages