def graphql(self, query, query_vars=None): response = self.call('graphql', query, query_vars=query_vars) if response['errors']: raise errors.KingPhisherGraphQLQueryError( 'the query failed', errors=response['errors'], query=query, query_vars=query_vars) return response['data']
def graphql(self, query, query_vars=None): """ Execute a GraphQL query on the server and return the results. This will raise :py:exc:`~king_phisher.errors.KingPhisherGraphQLQueryError` if the query fails. :param str query: The GraphQL query string to execute. :param query_vars: The variables for *query*. :return: The query results. :rtype: dict """ response = self.call('graphql', query, query_vars=query_vars) if response['errors']: raise errors.KingPhisherGraphQLQueryError( 'the query failed', errors=response['errors'], query=query, query_vars=query_vars) return response['data']