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 use the GraphQLView view from flask_graphql

from flask_graphql import GraphQLView

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

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

Supported options

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

  • context: A value to pass as the context to the graphql() function.

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

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

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

  • graphiql: If True, may present [GraphiQL][https://github.com/graphql/graphiql] when loaded directly from a browser (a useful tool for debugging and exploration).

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.3.1.tar.gz (6.2 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for Flask-GraphQL-1.3.1.tar.gz
Algorithm Hash digest
SHA256 828d9ef0f68e7879d0cea0d01a886b26fd776c931a1801efea331e8cbfb9ee6c
MD5 309a8e7c33390e2155428d607c119a19
BLAKE2b-256 05525b5ea8bba37bffa07442bc25fd6ca23d130ad8d6e94fd662cc55a8ce756e

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