gituser/docker_multiarch/: flask-graphql-2.0.1 metadata and description

Homepage Simple index

Adds GraphQL support to your Flask application

author Syrus Akbary
author_email me@syrusakbary.com
classifiers
  • Development Status :: 5 - Production/Stable
  • Intended Audience :: Developers
  • Topic :: Software Development :: Libraries
  • Programming Language :: Python :: 2
  • Programming Language :: Python :: 2.7
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 3.3
  • Programming Language :: Python :: 3.4
  • Programming Language :: Python :: 3.5
  • Programming Language :: Python :: 3.6
  • Programming Language :: Python :: 3.7
  • Programming Language :: Python :: Implementation :: PyPy
  • License :: OSI Approved :: MIT License
download_url https://github.com/graphql-python/flask-graphql/releases
keywords api graphql protocol rest flask
license MIT
requires_dist
  • graphql-core (<3,>=2.1)
  • flask (>=0.7.0)
  • graphql-server-core (<2,>=1.1)
File Tox results History
Flask_GraphQL-2.0.1-py3-none-any.whl
Size
6 KB
Type
Python Wheel
Python
3

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))

# Optional, for adding batch query support (used in Apollo-Client)
app.add_url_rule('/graphql/batch', view_func=GraphQLView.as_view('graphql', schema=schema, batch=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 when loaded directly from a browser (a useful tool for debugging and exploration).

  • graphiql_template: Inject a Jinja template string to customize GraphiQL.

  • batch: Set the GraphQL view as batch (for using in Apollo-Client or ReactRelayNetworkLayer)

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