(base_url, path, params, token, limit)
| 87 | |
| 88 | |
| 89 | def paged_get(base_url, path, params, token, limit): |
| 90 | results = [] |
| 91 | cursor = None |
| 92 | while len(results) < limit: |
| 93 | page_params = dict(params) |
| 94 | page_params["per_page"] = min(MAX_LIMIT, limit - len(results)) |
| 95 | if cursor: |
| 96 | page_params["cursor"] = cursor |
| 97 | url = build_url(base_url, path, page_params) |
| 98 | data, headers = request_json(url, token) |
| 99 | if not data: |
| 100 | break |
| 101 | results.extend(data) |
| 102 | cursor = next_cursor(headers.get("Link")) |
| 103 | if not cursor: |
| 104 | break |
| 105 | return results[:limit] |
| 106 | |
| 107 | |
| 108 | def require_org_project(org, project): |
no test coverage detected