subgrounds.client module#
Small module containing low level functions related to sending GraphQL http requests.
- subgrounds.client.get_schema(url, headers)#
Runs the introspection query on the GraphQL API served localed at
url
and returns the result. In case of errors, an exception containing the error message is thrown.- Parameters:
url (str) -- The url of the GraphQL API
- Raises:
HttpError -- If the request response resulted in an error
ServerError -- If server responds back non-json content
GraphQLError -- If the GraphQL query failed or other grapql server errors
- Returns:
The GraphQL API's schema in JSON
- Return type:
- subgrounds.client.query(url, query_str, variables={}, headers={})#
Executes the GraphQL query
query_str
with variablesvariables
against the API served aturl
and returns the response data. In case of errors, an exception containing the error message is thrown.- Parameters:
- Raises:
HttpError -- If the request response resulted in an error
ServerError -- If server responds back non-json content
GraphQLError -- If the GraphQL query failed or other grapql server errors
- Returns:
Response data
- Return type: