import requests
import yaml


def hosted_assemblies(string='all'):
    """Get prefixes of hosted datasets from BTK API."""
    btk = "https://blobtoolkit.genomehubs.org/api/v1/search/%s" % string
    response = requests.get(btk)
    hosted = set()
    if response.ok:
        data = yaml.full_load(response.text)
        for asm in data:
            hosted.add(asm['prefix'])
    return hosted