Example #1
0
def graphql_view(request):
    context = {'session': request.session}
    schema = graphene.Schema(query=Risultato)
    return serve_graphql_request(request,
                                 schema,
                                 context_value=context,
                                 graphiql_enabled=True)  #, batch_enabled=True)
Example #2
0
 def put(self, url, **extra):
     request = Request.blank(url, method='PUT', **extra)
     context_value = self.settings.pop('context_value', request)
     response = serve_graphql_request(request,
                                      self.schema,
                                      context_value=context_value,
                                      **self.settings)
     return response
Example #3
0
def main_graphiql(request):
    """
    View configuration for GraphiQL.

    :param request: current request of the server
    :return: graphql
    """
    LOG.debug("Show GraphiQL configuration")
    schema = graphene.Schema(query=Query)
    context = {'session': DBDiscussionSession}
    return serve_graphql_request(request,
                                 schema,
                                 batch_enabled=True,
                                 context_value=context)
Example #4
0
def graphql_get(request):
    """
    Perform a GET request.

    Args:
        request (pyramid.Request): The current request.
    Returns:
        The GraphQL response to the request.
    """
    context = {'session': request.session}
    return serve_graphql_request(
        request,
        schema,
        graphiql_enabled=config.get('graphiql_enabled'),
        context_value=context)
def graphql_view(request):
    context = {'session': request.dbsession}
    return serve_graphql_request(request, schema, context_value=context)
Example #6
0
 def graphql_serve_request(self, request):
     context = {'session': request}
     pprint(request)
     return serve_graphql_request(request,
                                  schema.schema,
                                  context_value=context)