def _login(session):
    """Login to UPS."""
    resp = session.get(LOGIN_URL, params=_get_params(session.auth.locale))
    parsed = BeautifulSoup(resp.text, HTML_PARSER)
    csrf = parsed.find(CSRF_FIND_TAG, CSRF_FIND_ATTR).get(VALUE_ATTR)
    resp = session.post(LOGIN_URL, {
        'userID': session.auth.username,
        'password': session.auth.password,
        'loginAction': 'X',
        'CSRFToken': csrf,
        'loc': session.auth.locale
    })
    if resp.status_code == 403:
        raise UPSError('login failure')
    parsed = BeautifulSoup(resp.text, HTML_PARSER)
    error = parsed.find(ERROR_FIND_TAG, ERROR_FIND_ATTR)
    if error and error.string:
        raise UPSError(error.string.strip())
    _save_cookies(session.cookies, session.auth.cookie_path)