Login to Fedex Delivery Manager.

def _login(session):
    """Login to Fedex Delivery Manager."""
    session.get(LOGIN_REFERER)
    resp = session.post(LOGIN_URL, {
        'user': session.auth.username,
        'pwd': session.auth.password
    }, headers={
        'Referer': LOGIN_REFERER,
        'X-Requested-With': 'XMLHttpRequest'
    })
    if resp.status_code != 200:
        raise FedexError('could not login')
    data = resp.json()
    if not data['successful']:
        raise FedexError(data['errorList'][0]['error']['message'])
    _save_cookies(session.cookies, session.auth.cookie_path)