MCPcopy Create free account
hub / github.com/kubernetes/test-infra / do_github_graphql_request

Function do_github_graphql_request

experiment/graphql_issue_example.py:28–46  ·  view source on GitHub ↗

performs a requests.put with the correct headers for a GitHub request. see: https://developer.github.com/v4/ Args: query: the graphQL query string (excluding the variables section) token: a GitHub API token string variables: a dict of key=value variables that will be sent with

(query, token, variables=None)

Source from the content-addressed store, hash-verified

26
27
28def do_github_graphql_request(query, token, variables=None):
29 """performs a requests.put with the correct headers for a GitHub request.
30
31 see: https://developer.github.com/v4/
32
33 Args:
34 query: the graphQL query string (excluding the variables section)
35 token: a GitHub API token string
36 variables: a dict of key=value variables that will be sent with the query
37
38 Returns:
39 A requests.Response object
40 """
41 url = "https://api.github.com/graphql"
42 headers = {
43 "Authorization": "bearer " + token,
44 }
45 data = json.dumps({"query": query, "variables": json.dumps(variables)})
46 return requests.post(url, headers=headers, data=data)
47
48
49ISSUES_QUERY = """

Callers 1

get_issuesFunction · 0.85

Calls 1

postMethod · 0.45

Tested by

no test coverage detected