Esempio n. 1
0
def load_all_assets(url_to_load):
    keep_loading = True
    results = {
        'count': 0,
        'results': []
    }

    while keep_loading:
        # Assume we are done
        keep_loading = False

        # Get the URL
        response_object = client.request('GET', url_to_load)
        response = response_object.json()

        # Update the count and results
        results['count'] += response['count']
        results['results'] += response['results']

        # Check if we have a next
        if 'next' in response and response['next']:
            url_to_load = response['next']
            keep_loading = True

    return results
Esempio n. 2
0
def load_all_assets(url_to_load):
    keep_loading = True
    results = {
        'count': 0,
        'results': []
    }

    while keep_loading:
        # Assume we are done
        keep_loading = False

        # Get the URL
        response_object = client.request('GET', url_to_load)
        response = response_object.json()

        # Update the count and results
        results['count'] += response['count']
        results['results'] += response['results']

        # Check if we have a next
        if 'next' in response and response['next']:
            url_to_load = response['next']
            keep_loading = True

    return results