Get deliveries in progress and completed.

def get_packages(session):
    """Get deliveries in progress and completed."""
    resp = session.get(DELIVERIES_URL, params=_get_params(session.auth.locale))
    parsed = BeautifulSoup(resp.text, HTML_PARSER)
    token_elem = parsed.find(TOKEN_FIND_TAG, TOKEN_FIND_ATTR)
    tid_elem = parsed.find(TID_FIND_TAG, TID_FIND_ATTR)
    if not token_elem or not tid_elem:
        raise UPSError('failed to find token or tid')
    token = token_elem.get(VALUE_ATTR)
    tid = tid_elem.get(VALUE_ATTR)
    resp = session.post(SERVICE_URL, {
        'token': token,
        'uid': session.auth.username,
        'callType': 'allShipments',
        'tid': tid,
        'loc': session.auth.locale
    })
    try:
        packages = []
        data = json.loads(resp.text[UPS_JSON_PREAMBLE_SIZE:])
        shipments = data['shipmentContainer']['inboundShipments'] + \
            data['shipmentContainer']['historyShipments']
        for shipment in shipments:
            from_location = '{}, {}, {}'.format(shipment['sfc'],
                                                shipment['sfs'],
                                                shipment['sfcn'])
            estimated_date = _parsed_date(shipment['sddfd'])
            actual_date = _parsed_date(shipment['dd'])
            packages.append({
                'tracking_number': shipment['tn'],
                'status': shipment['sts'],
                'from': shipment['sfn'],
                'from_location': from_location,
                'estimated_delivery_date': estimated_date,
                'estimated_delivery_timeframe': shipment['sdtfd'],
                'delivery_date': actual_date
            })
        return packages
    except JSONDecodeError:
        raise UPSError('failed to parse json')