Pagination for comments
This commit is contained in:
parent
6c53c3cdea
commit
8e7648ce5a
1 changed files with 7 additions and 3 deletions
10
gitlab.py
10
gitlab.py
|
@ -69,8 +69,8 @@ def set_assignees(iid, assignee_ids):
|
||||||
print(req.status_code)
|
print(req.status_code)
|
||||||
|
|
||||||
|
|
||||||
def get_comments(iid):
|
def get_comments(iid, page=1):
|
||||||
params = {"sort": "asc"}
|
params = {"sort": "asc", "page": page}
|
||||||
headers = {"Private-Token": TOKEN}
|
headers = {"Private-Token": TOKEN}
|
||||||
|
|
||||||
with requests.get(
|
with requests.get(
|
||||||
|
@ -78,4 +78,8 @@ def get_comments(iid):
|
||||||
params=params,
|
params=params,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
) as req:
|
) as req:
|
||||||
return req.json()
|
comments = req.json()
|
||||||
|
if 'rel="next"' in req.headers["Link"]:
|
||||||
|
comments.extend(get_comments(iid, page + 1))
|
||||||
|
return comments
|
||||||
|
|
||||||
|
|
Reference in a new issue