Open webratz opened 5 years ago
Quick hack is get all entries with big count
parameter.
vcss = tc.vcs_root.get_roots(locator='count:20000')
It seems now there is no way to get the next results, nextRef is only string for now.
ah, thx. in the meanwhile i did for that specific call direct http calls and use the library for the rest. but i guess with this workaround i can remove the manual calls
python-gitlab have a great solution. I have use below code and don't worry about pagination. We need realize something similar
pr = gl.projects.get(209)
piter = pr.pipelines.list(as_list=False)
for pipeline in piter:
pinfo = pr.pipelines.get(pipeline.id)
print(pinfo.created_at)
list()
methods can also return a generator object which will handle the next calls to the API when required. This is the recommended way to iterate through a large number of items:
items = gl.groups.list(as_list=False)
for item in items:
print(item.attributes)
The generator exposes extra listing information as received from the server:
current_page: current page number (first page is 1) prev_page: if None the current page is the first one next_page: if None the current page is the last one per_page: number of items per page total_pages: total number of pages available total: total number of items in the list
I'm requesting sth, that returns more than 100 results. eg:
tc.vcs_root_api.get_roots()
This obviously returns a paginated result, as also thenext_href
etc is set. From the docs it's unclear to me how to access the next pages of the result. Could you maybe give a hint what the right way would be todo this?