Pagination for comments

This commit is contained in:
Matej Focko 2019-11-23 13:46:37 +01:00
parent 6c53c3cdea
commit 8e7648ce5a

View file

@ -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