All Projects → graphql-python → aiohttp-graphql

graphql-python / aiohttp-graphql

Licence: other
Adds GraphQL support to your aiohttp app.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to aiohttp-graphql

trellio
Python3 asyncio based microframework for microservice architecture
Stars: ✭ 19 (-83.76%)
Mutual labels:  aiohttp
tomodachi
💻 Microservice library / framework using Python's asyncio event loop with full support for HTTP + WebSockets, AWS SNS+SQS, RabbitMQ / AMQP, middleware, etc. Extendable for GraphQL, protobuf, gRPC, among other technologies.
Stars: ✭ 170 (+45.3%)
Mutual labels:  aiohttp
stream video server
demonstrates how to create video streaming server with the help of aiohttp and opencv
Stars: ✭ 15 (-87.18%)
Mutual labels:  aiohttp
yutto
🧊 一个可爱且任性的 B 站视频下载器(bilili V2)
Stars: ✭ 383 (+227.35%)
Mutual labels:  aiohttp
python-logi-circle
Python 3.6+ API for Logi Circle cameras
Stars: ✭ 23 (-80.34%)
Mutual labels:  aiohttp
DEEPaaS
A REST API to serve machine learning and deep learning models
Stars: ✭ 26 (-77.78%)
Mutual labels:  aiohttp
aiohttp-three-template
Project template for Python aiohttp three-tier web applications
Stars: ✭ 20 (-82.91%)
Mutual labels:  aiohttp
pyladies-courseware
Homework/task submit and review web app · based on React and Python aiohttp
Stars: ✭ 14 (-88.03%)
Mutual labels:  aiohttp
python3-concurrency
Python3爬虫系列的理论验证,首先研究I/O模型,分别用Python实现了blocking I/O、nonblocking I/O、I/O multiplexing各模型下的TCP服务端和客户端。然后,研究同步I/O操作(依序下载、多进程并发、多线程并发)和异步I/O(asyncio)之间的效率差别
Stars: ✭ 49 (-58.12%)
Mutual labels:  aiohttp
aiohttp-json-rpc
Implements JSON-RPC 2.0 using aiohttp
Stars: ✭ 54 (-53.85%)
Mutual labels:  aiohttp
megadlbot oss
Megatron was a telegram file management bot that helped a lot of users, specially movie channel managers to upload their files to telegram by just providing a link to it. The project initially started as roanuedhuru_bot which lately retired and came back as Megatron which was a side project of the famous Maldivian Telegram community - @baivaru u…
Stars: ✭ 151 (+29.06%)
Mutual labels:  aiohttp
pytest-aiohttp
pytest plugin for aiohttp support
Stars: ✭ 110 (-5.98%)
Mutual labels:  aiohttp
netunnel
A tool to create network tunnels over HTTP/S written in Python 3
Stars: ✭ 19 (-83.76%)
Mutual labels:  aiohttp
Pyaiodl
A python Asynchronous Downloader - Pyaiodl
Stars: ✭ 40 (-65.81%)
Mutual labels:  aiohttp
logger-python
Log API requests and responses with Python
Stars: ✭ 22 (-81.2%)
Mutual labels:  aiohttp
aioneo4j
asyncio client for neo4j
Stars: ✭ 29 (-75.21%)
Mutual labels:  aiohttp
aiohttp-swagger3
Library for swagger documentation browsing and validating aiohttp requests using swagger specification 3.0
Stars: ✭ 54 (-53.85%)
Mutual labels:  aiohttp
performance monitor
Monitor Linux system
Stars: ✭ 30 (-74.36%)
Mutual labels:  aiohttp
aiohttp-mako
mako template renderer for aiohttp.web
Stars: ✭ 32 (-72.65%)
Mutual labels:  aiohttp
aiohttp-cache
A cache system for aiohttp server
Stars: ✭ 39 (-66.67%)
Mutual labels:  aiohttp

aiohttp-graphql

Adds GraphQL support to your aiohttp application.

Based on flask-graphql by Syrus Akbary and sanic-graphql by Sergey Porivaev.

PyPI version Build Status Coverage Status

Usage

Use the GraphQLView view from aiohttp_graphql

from aiohttp import web
from aiohttp_graphql import GraphQLView

from schema import schema

app = web.Application()

GraphQLView.attach(app, schema=schema, graphiql=True)

# Optional, for adding batch query support (used in Apollo-Client)
GraphQLView.attach(app, schema=schema, batch=True, route_path="/graphql/batch")

if __name__ == '__main__':
    web.run_app(app)

This will add /graphql endpoint to your app (customizable by passing route_path='/mypath' to GraphQLView.attach) and enable the GraphiQL IDE.

Note: GraphQLView.attach is just a convenience function, and the same functionality can be achieved with

gql_view = GraphQLView(schema=schema, graphiql=True)
app.router.add_route('*', '/graphql', gql_view, name='graphql')

It's worth noting that the the "view function" of GraphQLView is contained in GraphQLView.__call__. So, when you create an instance, that instance is callable with the request object as the sole positional argument. To illustrate:

gql_view = GraphQLView(schema=Schema, **kwargs)
gql_view(request)  # <-- the instance is callable and expects a `aiohttp.web.Request` object.

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".
  • jinja_env: Sets jinja environment to be used to process GraphiQL template. If Jinja’s async mode is enabled (by enable_async=True), uses Template.render_async instead of Template.render. If environment is not set, fallbacks to simple regex-based renderer.
  • batch: Set the GraphQL view as batch (for using in Apollo-Client or ReactRelayNetworkLayer)
  • middleware: A list of graphql middlewares.
  • max_age: Sets the response header Access-Control-Max-Age for preflight requests.
  • 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.
  • enable_async: whether async mode will be enabled.
  • 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.

Contributing

Since v3, aiohttp-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.

License

Copyright for portions of project aiohttp-graphql are held by Syrus Akbary as part of project flask-graphql and sanic-graphql as part of project Sergey Porivaev. All other claims to this project aiohttp-graphql are held by Devin Fee.

This project is licensed under the MIT License.

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].