Skip to main content

Adds GraphQL support to your Flask application

Project description

Build Status Coverage Status PyPI version

Adds GraphQL support to your Flask application.

Usage

Just create a GraphQL instance from flask_graphql

from flask_graphql import GraphQL

graphql_blueprint = GraphQL(app, schema=schema)

This will add /graphql and /graphiql endpoints to your app.

Customization

This package provides the following Views: * GraphQLView: endpoint for expose the GraphQL schema * GraphiQLView: Graphical Interface for operate with GraphQL easily

You can also add only the views you want to use:

from flask_graphql import GraphQLView, GraphiQLView

app.add_url_rule('/graphql', view_func=GraphQLView.as_view('graphql', schema=schema))

Supported options

  • schema: The GraphQLSchema object that you want the view to execute when it gets a valid request.

  • pretty: Whether or not you want the response to be pretty printed JSON.

  • executor: The Executor that you want to use to execute queries.

  • root_value: The root_value you want to provide to executor.execute.

  • default_query: The default_query you want to provide to GraphiQL interface.

You can also subclass GraphQLView and overwrite get_root_value(self, request) to have a dynamic root value per request.

class UserRootValue(GraphQLView):
    def get_root_value(self, request):
        return request.user

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-GraphQL-1.1.0.tar.gz (171.7 kB view details)

Uploaded Source

File details

Details for the file Flask-GraphQL-1.1.0.tar.gz.

File metadata

File hashes

Hashes for Flask-GraphQL-1.1.0.tar.gz
Algorithm Hash digest
SHA256 24a334ce76839387799aa40bfde9a9f4124ffe51b17cb7196bda471ee0d9e631
MD5 4da9ed1621338ef3939e353734f2fc51
BLAKE2b-256 d5456431084f97988e5188cee9c6ca9e99963075483eb90fee9a49bd52af89e4

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page