All Projects → graphql-python → Flask Graphql

graphql-python / Flask Graphql

Licence: mit
Adds GraphQL support to your Flask application.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Flask Graphql

Yublog
Person blog powered by flask.
Stars: ✭ 164 (-86.2%)
Mutual labels:  flask-application, flask
Flask Graphene Sqlalchemy
⚗️Project template to build a GraphQL API in Python
Stars: ✭ 109 (-90.82%)
Mutual labels:  graphql, flask
Flask ishuhui
Comic reading website built by flask.
Stars: ✭ 172 (-85.52%)
Mutual labels:  flask-application, flask
Jiosaavnapi
An unofficial API for JioSaavn written in Python 3
Stars: ✭ 123 (-89.65%)
Mutual labels:  flask-application, flask
Intro To Apis Flask
Starter repository for the Introductions to API course
Stars: ✭ 26 (-97.81%)
Mutual labels:  flask-application, flask
Pyxtermjs
A fully functional terminal in your browser.
Stars: ✭ 127 (-89.31%)
Mutual labels:  flask-application, flask
Spacy Graphql
🤹‍♀️ Query spaCy's linguistic annotations using GraphQL
Stars: ✭ 81 (-93.18%)
Mutual labels:  graphql, flask
Uwsgi Nginx Flask Docker
Docker image with uWSGI and Nginx for Flask applications in Python running in a single container. Optionally with Alpine Linux.
Stars: ✭ 2,607 (+119.44%)
Mutual labels:  flask-application, flask
Responder
A familiar HTTP Service Framework for Python.
Stars: ✭ 3,569 (+200.42%)
Mutual labels:  graphql, flask
Plotlydash Flask Tutorial
📊📉Embed Plotly Dash into your Flask applications.
Stars: ✭ 265 (-77.69%)
Mutual labels:  flask-application, flask
Flask Rest Template
template for a rest app with flask, flask-rest and more...
Stars: ✭ 95 (-92%)
Mutual labels:  flask-application, flask
Best Of Web Python
🏆 A ranked list of awesome python libraries for web development. Updated weekly.
Stars: ✭ 1,118 (-5.89%)
Mutual labels:  graphql, flask
Apps
Carson Sievert's web applications
Stars: ✭ 77 (-93.52%)
Mutual labels:  flask-application, flask
Appkernel
API development made easy: a smart Python 3 API framework
Stars: ✭ 152 (-87.21%)
Mutual labels:  flask-application, flask
Python Dependency Injector
Dependency injection framework for Python
Stars: ✭ 1,203 (+1.26%)
Mutual labels:  flask-application, flask
Flask Graphene Sqlalchemy
A demo project for Flask + GraphQL (With Graphene & SQLAlchemy)
Stars: ✭ 117 (-90.15%)
Mutual labels:  graphql, flask
Cancer Donation Portal Python Flask App
Flask App for Cancer Donation Portal using basic Python, SQLite3, HTML, CSS and Javascript
Stars: ✭ 32 (-97.31%)
Mutual labels:  flask-application, flask
Graphql Server
This is the core package for using GraphQL in a custom server easily
Stars: ✭ 65 (-94.53%)
Mutual labels:  graphql, flask
Flask Website
The Flask website, built with Flask!
Stars: ✭ 1,169 (-1.6%)
Mutual labels:  flask
Facebook Graph Api
Get data using facebook graph API - V3.2
Stars: ✭ 73 (-93.86%)
Mutual labels:  graphql

Flask-GraphQL

Adds GraphQL support to your Flask application.

travis pypi Anaconda-Server Badge coveralls

Usage

Just use the GraphQLView view from flask_graphql

from flask import Flask
from flask_graphql import GraphQLView

from schema import schema

app = Flask(__name__)

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

if __name__ == '__main__':
    app.run()

This will add /graphql endpoint to your app and enable the GraphiQL IDE.

Special Note for Graphene v3

If you are using the Schema type of Graphene library, be sure to use the graphql_schema attribute to pass as schema on the GraphQLView view. Otherwise, the GraphQLSchema from graphql-core is the way to go.

More info at Graphene v3 release notes and GraphQL-core 3 usage.

Supported options for GraphQLView

  • 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_value to graphql execute function. By default is set to dict with request object at key request.
  • root_value: The root_value you want to provide to graphql execute.
  • pretty: Whether or not you want the response to be pretty printed JSON.
  • graphiql: If True, may present GraphiQL when loaded directly from a browser (a useful tool for debugging and exploration).
  • graphiql_version: The graphiql version to load. Defaults to "1.0.3".
  • graphiql_template: Inject a Jinja template string to customize GraphiQL.
  • graphiql_html_title: The graphiql title to display. Defaults to "GraphiQL".
  • batch: Set the GraphQL view as batch (for using in Apollo-Client or ReactRelayNetworkLayer)
  • middleware: A list of graphql middlewares.
  • encode: the encoder to use for responses (sensibly defaults to graphql_server.json_encode).
  • format_error: the error formatter to use for responses (sensibly defaults to graphql_server.default_format_error.
  • subscriptions: The GraphiQL socket endpoint for using subscriptions in graphql-ws.
  • headers: An optional GraphQL string to use as the initial displayed request headers, if not provided, the stored headers will be used.
  • default_query: An optional GraphQL string to use when no query is provided and no stored query exists from a previous session. If not provided, GraphiQL will use its own default query.
  • header_editor_enabled: An optional boolean which enables the header editor when true. Defaults to false.
  • should_persist_headers: An optional boolean which enables to persist headers to storage when true. Defaults to false.

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

Contributing

Since v3, flask-graphql code lives at graphql-server repository to keep any breaking change on the base package on sync with all other integrations. In order to contribute, please take a look at CONTRIBUTING.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].