sregistry/main/base/http.py
def paginate_get(self, url, 
                 headers=None, 
                 return_json=True,
                 start_page=None):
    '''paginate_call is a wrapper for get to paginate results
    '''

    geturl = '%s&page=1' %(url)
    if start_page is not None:
        geturl = '%s&page=%s' %(url,start_page)

    results = []
    while geturl is not None:
        result = self._get(url, headers=headers, return_json=return_json)
        # If we have pagination:
        if isinstance(result, dict):
            if 'results' in result:
                results = results + result['results']
            geturl = result['next']
        # No pagination is a list
        else:
            return result
    return results
def paginate_get(self, url, 
                 headers=None, 
                 return_json=True,
                 start_page=None):
    '''paginate_call is a wrapper for get to paginate results
    '''

    geturl = '%s&page=1' %(url)
    if start_page is not None:
        geturl = '%s&page=%s' %(url,start_page)

    results = []
    while geturl is not None:
        result = self._get(url, headers=headers, return_json=return_json)
        # If we have pagination:
        if isinstance(result, dict):
            if 'results' in result:
                results = results + result['results']
            geturl = result['next']
        # No pagination is a list
        else:
            return result
    return results
paginate_call is a wrapper for get to paginate results