WSGI compatibility for AWS API Gateway proxy resources
Makes Python WSGI apps compatible with AWS’ API Gateway proxy resources.
from flask import Flask import apigwsgi app = Flask(__name__) @app.route("/") def index(): return "Hello from Flask!" handler = apigwsgi.Handler(app.wsgi_app)
Full example including deployment scripts can be found in the examples directory.
$ pip install boto3 $ examples/flask_handler/bin/deploy [...] Uploaded Flask example to https://xxxxx.execute-api.us-east-1.amazonaws.com/live/
When you’re done, remove it with:
API Gateway doesn’t currently support binary responses, and will fail if your application sends non-unicode data.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.