import requests


def _download_collection(url):
    """
    Download all pages in a paginated mgnify data collection
    This returns a single structure with all entries appended to result['data']
    """
    result = {'data': []}
    while url is not None:
        resp = requests.get(url, params={'page_size': 100}).json()
        result['data'] += resp['data']
        url = resp['links']['next']
    return result