MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / fetch_github_repo_contributors

Function fetch_github_repo_contributors

api/integrations/github/client.py:271–298  ·  view source on GitHub ↗
(
    organisation_id: int,
    params: RepoQueryParams,
)

Source from the content-addressed store, hash-verified

269
270
271def fetch_github_repo_contributors(
272 organisation_id: int,
273 params: RepoQueryParams,
274) -> dict[str, Any]:
275 installation_id = GithubConfiguration.objects.get(
276 organisation_id=organisation_id, deleted_at__isnull=True
277 ).installation_id
278
279 url = (
280 f"{GITHUB_API_URL}repos/{params.repo_owner}/{params.repo_name}/contributors?"
281 + f"&per_page={params.page_size}&page={params.page}"
282 )
283
284 headers = build_request_headers(installation_id)
285 response = requests.get(url, headers=headers, timeout=GITHUB_API_CALLS_TIMEOUT)
286 response.raise_for_status()
287 json_response = response.json()
288
289 results = [
290 {
291 "login": i["login"],
292 "avatar_url": i["avatar_url"],
293 "contributions": i["contributions"],
294 }
295 for i in json_response
296 ]
297
298 return build_paginated_response(results, response)
299
300
301def create_flagsmith_flag_label( # type: ignore[return]

Callers 1

fetch_repo_contributorsFunction · 0.90

Calls 5

build_request_headersFunction · 0.85
build_paginated_responseFunction · 0.85
getMethod · 0.45
raise_for_statusMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…