MCPcopy
hub / github.com/vinta/awesome-python / fetch_batch

Function fetch_batch

website/fetch_github_stars.py:81–93  ·  view source on GitHub ↗

Fetch star data for a batch of repos via GitHub GraphQL API.

(repos: Sequence[str], client: httpx.Client)

Source from the content-addressed store, hash-verified

79
80
81def fetch_batch(repos: Sequence[str], client: httpx.Client) -> dict[str, dict]:
82 """Fetch star data for a batch of repos via GitHub GraphQL API."""
83 query = build_graphql_query(repos)
84 if not query:
85 return {}
86 resp = client.post(GRAPHQL_URL, json={"query": query})
87 resp.raise_for_status()
88 result = resp.json()
89 if "errors" in result:
90 for err in result["errors"]:
91 print(f" Warning: {err.get('message', err)}", file=sys.stderr)
92 data = result.get("data", {})
93 return parse_graphql_response(data, repos)
94
95
96def main() -> None:

Callers 1

mainFunction · 0.85

Calls 2

build_graphql_queryFunction · 0.85
parse_graphql_responseFunction · 0.85

Tested by

no test coverage detected