carolus_holman
11/03/2021, 2:28 PMaaronsteers
11/03/2021, 2:50 PMcarolus_holman
11/03/2021, 3:39 PMcarolus_holman
11/03/2021, 7:50 PMcarolus_holman
11/03/2021, 7:50 PM# X-Total-Pages header is not always available since GitLab 11.8
# <https://docs.gitlab.com/ee/api/#other-pagination-headers>
# X-Next-Page to check if there is another page available and iterate
next_page = 1
_try_:
_while_ next_page:
params['page'] = int(next_page)
resp = request(url, params)
resp_json = resp.json()
# handle endpoints that return a single JSON object
_if_ isinstance(resp_json, dict):
_yield_ resp_json
# handle endpoints that return an array of JSON objects
_else_:
_for_ row _in_ resp_json:
_yield_ row
next_page = resp.headers.get('X-Next-Page', None)
_except_ ResourceInaccessible _as_ exc:
# Don't halt execution if a Resource is Inaccessible
# Just skip it and continue with the rest of the extraction
_return_ []
carolus_holman
11/03/2021, 7:51 PMcarolus_holman
11/03/2021, 7:51 PMcarolus_holman
11/03/2021, 7:53 PMaaronsteers
11/03/2021, 9:34 PMaaronsteers
11/03/2021, 9:35 PMaaronsteers
11/03/2021, 9:36 PMSince Gitlab 12.6, the max number of projects returned is hardcoded to 100. There is no pagination available.
carolus_holman
11/03/2021, 10:28 PMaaronsteers
11/03/2021, 11:22 PMcarolus_holman
11/04/2021, 11:20 AM