def get_nodes_by_site():
    r = requests.get(SITES_API + "?no_hyperlinks=1", auth=opencloud_auth)
    sites_list = r.json()
    sites = {}
    for site in sites_list:
        site["hostnames"] = []
        sites[str(site["id"])] = site

    r = requests.get(NODES_API + "?no_hyperlinks=1", auth=opencloud_auth)
    nodes = r.json()
    for node in nodes:
        site_id = str(node["site"])
        if site_id in sites:
            sites[site_id]["hostnames"].append(node["name"])

    return sites
dataset/ETHPy150Open open-cloud/xos/xos/tools/ansible_hosts.py/get_nodes_by_site/original