MCPcopy
hub / github.com/fastapi/fastapi / get_graphql_response

Function get_graphql_response

scripts/contributors.py:121–145  ·  view source on GitHub ↗
(
    *,
    settings: Settings,
    query: str,
    after: str | None = None,
)

Source from the content-addressed store, hash-verified

119
120
121def get_graphql_response(
122 *,
123 settings: Settings,
124 query: str,
125 after: str | None = None,
126) -> dict[str, Any]:
127 headers = {"Authorization": f"token {settings.github_token.get_secret_value()}"}
128 variables = {"after": after}
129 response = httpx.post(
130 github_graphql_url,
131 headers=headers,
132 timeout=settings.httpx_timeout,
133 json={"query": query, "variables": variables, "operationName": "Q"},
134 )
135 if response.status_code != 200:
136 logging.error(f"Response was not 200, after: {after}")
137 logging.error(response.text)
138 raise RuntimeError(response.text)
139 data = response.json()
140 if "errors" in data:
141 logging.error(f"Errors in response, after: {after}")
142 logging.error(data["errors"])
143 logging.error(response.text)
144 raise RuntimeError(response.text)
145 return data
146
147
148def get_graphql_pr_edges(

Callers 1

get_graphql_pr_edgesFunction · 0.70

Calls 1

postMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…