aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/apis/github/teams.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-05-10 17:17:26 +0100
committerGravatar Chris Lovering <[email protected]>2024-05-10 17:17:26 +0100
commit39e2077f8b3ec096ee286c08a1f92cc76d4f5ae5 (patch)
treebd22d7039e0d4d0613540a4ee55fc7ec870841ee /arthur/apis/github/teams.py
parentIncrease number of members returned by GitHub API teams query (diff)
Reduce the number of github team members fetched per page to 100
Diffstat (limited to 'arthur/apis/github/teams.py')
-rw-r--r--arthur/apis/github/teams.py6
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()