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)
|
||||
|
||||
|
||||
def get_comments(iid):
|
||||
params = {"sort": "asc"}
|
||||
def get_comments(iid, page=1):
|
||||
params = {"sort": "asc", "page": page}
|
||||
headers = {"Private-Token": TOKEN}
|
||||
|
||||
with requests.get(
|
||||
|
@ -78,4 +78,8 @@ def get_comments(iid):
|
|||
params=params,
|
||||
headers=headers,
|
||||
) 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