aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/apis/github/teams.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-05-10 17:18:30 +0100
committerGravatar Chris Lovering <[email protected]>2024-05-10 17:18:30 +0100
commit19d25e74a549616f4ad628ef4d9a2b5b3f725620 (patch)
tree7f5081dec89dbbd34819f90d29d2c81a467b5fe1 /arthur/apis/github/teams.py
parentReduce the number of github team members fetched per page to 100 (diff)
Warn when the max number of members per page is returned by Github's API.
This is so that we know when it's time to implement paginated fetching of these members.
Diffstat (limited to 'arthur/apis/github/teams.py')
-rw-r--r--arthur/apis/github/teams.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/arthur/apis/github/teams.py b/arthur/apis/github/teams.py
index c16e2d9..4cf18d4 100644
--- a/arthur/apis/github/teams.py
+++ b/arthur/apis/github/teams.py
@@ -1,6 +1,7 @@
import aiohttp
from arthur.config import CONFIG
+from arthur.log import logger
HEADERS = {
"Accept": "application/vnd.github+json",
@@ -21,4 +22,11 @@ async def list_team_members(team_slug: str, session: aiohttp.ClientSession) -> l
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()
+ teams_resp = await response.json()
+ if len(teams_resp) == MEMBERS_PER_PAGE:
+ logger.warning(
+ "Max number (%d) of members returned when fetching members of %s. Some members may have been missed.",
+ MEMBERS_PER_PAGE,
+ team_slug,
+ )
+ return teams_resp