MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / graphql_query

Method graphql_query

github/Requester.py:703–722  ·  view source on GitHub ↗

Queries the GraphQL API. :param query: GraphQL query :param variables: GraphQL variables :return: ``(headers: dict, JSON Response: dict)`` :raises: :class:`GithubException` for error status codes

(self, query: str, variables: dict[str, Any])

Source from the content-addressed store, hash-verified

701 return klass(self, headers, data)
702
703 def graphql_query(self, query: str, variables: dict[str, Any]) -> tuple[dict[str, Any], dict[str, Any]]:
704 """
705 Queries the GraphQL API.
706
707 :param query: GraphQL query
708 :param variables: GraphQL variables
709 :return: ``(headers: dict, JSON Response: dict)``
710 :raises: :class:`GithubException` for error status codes
711
712 """
713 input_ = {"query": query, "variables": variables}
714
715 response_headers, data = self.requestJsonAndCheck("POST", self.graphql_url, input=input_)
716 if "errors" in data:
717 if len(data["errors"]) == 1:
718 error = data["errors"][0]
719 if error.get("type") == "NOT_FOUND":
720 raise github.UnknownObjectException(404, data, response_headers, error.get("message"))
721 raise self.createException(400, response_headers, data)
722 return response_headers, data
723
724 def graphql_query_class(
725 self, query: str, variables: dict[str, Any], data_path: list[str], klass: type[T_gh]

Callers 6

graphql_query_classMethod · 0.95
graphql_nodeMethod · 0.95
totalCountMethod · 0.80
_fetchNextPageMethod · 0.80
testQueryMethod · 0.80

Calls 3

requestJsonAndCheckMethod · 0.95
createExceptionMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected