diff options
author | 2024-05-10 17:17:26 +0100 | |
---|---|---|
committer | 2024-05-10 17:17:26 +0100 | |
commit | 39e2077f8b3ec096ee286c08a1f92cc76d4f5ae5 (patch) | |
tree | bd22d7039e0d4d0613540a4ee55fc7ec870841ee | |
parent | Increase number of members returned by GitHub API teams query (diff) |
Reduce the number of github team members fetched per page to 100
-rw-r--r-- | arthur/apis/github/teams.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arthur/apis/github/teams.py b/arthur/apis/github/teams.py index cdf3387..c16e2d9 100644 --- a/arthur/apis/github/teams.py +++ b/arthur/apis/github/teams.py @@ -8,6 +8,7 @@ HEADERS = { "Authorization": f"Bearer {CONFIG.github_token.get_secret_value()}", } BASE_URL = "https://api.github.com" +MEMBERS_PER_PAGE = 100 class GithubTeamNotFoundError(aiohttp.ClientResponseError): @@ -16,7 +17,8 @@ class GithubTeamNotFoundError(aiohttp.ClientResponseError): async def list_team_members(team_slug: str, session: aiohttp.ClientSession) -> list[dict[str, str]]: """List all Github teams.""" - endpoint = BASE_URL + f"/orgs/{CONFIG.github_org}/teams/{team_slug}/members?per_page=500" - async with session.get(endpoint, headers=HEADERS) as response: + endpoint = f"{BASE_URL}/orgs/{CONFIG.github_org}/teams/{team_slug}/members" + params = {"per_page": MEMBERS_PER_PAGE} + async with session.get(endpoint, headers=HEADERS, params=params) as response: response.raise_for_status() return await response.json() |