

def remove_version_from_href(href):
    "Removes the first api version from the href.\n\n    Given: 'http://www.nova.com/v1.1/123'\n    Returns: 'http://www.nova.com/123'\n\n    Given: 'http://www.nova.com/v1.1'\n    Returns: 'http://www.nova.com'\n\n    "
    parsed_url = urlparse.urlsplit(href)
    new_path = re.sub('^/v[0-9]+\\.[0-9]+(/|$)', '\\1', parsed_url.path, count=1)
    if (new_path == parsed_url.path):
        msg = (_('href %s does not contain version') % href)
        LOG.debug(msg)
        raise ValueError(msg)
    parsed_url = list(parsed_url)
    parsed_url[2] = new_path
    return urlparse.urlunsplit(parsed_url)

dataset/ETHPy150Open nii-cloud/dodai-compute/nova/api/openstack/common.py remove_version_from_href/original