{ "info": { "author": "Ben Jones", "author_email": "ben@fogbutter.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development" ], "description": "Sippy Cup\n=========\n\n.. image:: https://circleci.com/gh/RealSalmon/sippycup.svg?style=svg\n :target: https://circleci.com/gh/RealSalmon/sippycup\n\nPython Adaptor for Serving WSGI Applications with AWS Lambda and API Gateway\n----------------------------------------------------------------------------\n\nSippy Cup is an *extremely* minimalistic `Python`_ adaptor that allows `WSGI`_\napplications to be served using using `AWS API Gateway`_ and `AWS Lambda`_\nproxy integration.\n\nSippy Cup converts the input format sent to an AWS Lambda function by API\nGateway into a `WSGI`_ environment that is used to run a the application.\nThe application's response is then converted to a format that can be understood\nby API Gateway.\n\nWhen the WSGI environment is created, some additional values from the event\nsent to AWS Lambda from API Gateway are also added. See the demo app below\nfor how to access these.\n\n- **apigateway:** True\n- **apigateway.stageVariables:** API Gateway stage variables\n- **apigateway.requestContext:** The event request context\n\nGetting started\n~~~~~~~~~~~~~~~\n\nInstallation\n^^^^^^^^^^^^\n\nBecause you will eventually need to `create a deployment package`_, it\nis highly recommended that you use a `virtualenv`_ when using Sippy Cup.\n\n::\n\n pip install sippycup\n\nCreate a simple application\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nlambda\\_function.py provides a demo application\n\n.. code:: python\n\n # lambda_function.py\n\n from flask import Flask, Response, request, jsonify\n from sippycup import sippycup\n\n app = Flask(__name__)\n\n @app.route('/hello/', methods=['GET', 'POST'])\n @app.route('/hello/', methods=['GET', 'POST'])\n def hello_world(name='World'):\n return Response('Hello, {0}!'.format(name), mimetype='text/plain')\n\n\n @app.route('/')\n def index():\n # return the additional WSGI environment variables that SippyCup\n # provides\n return jsonify({\n 'requestContext': request.environ['apigateway.requestContext'],\n 'stageVariables': request.environ['apigateway.stageVariables']\n })\n\n\n def lambda_handler(event, context):\n return sippycup(app, event, context)\n\n\n if __name__ == '__main__':\n app.run()\n\n\n\nYou will need to `create a deployment package`_ and use that to create a new\nAWS Lambda function.\n\nFinally, `set up an API Gateway proxy resource with the lambda proxy\nintegration`_. It is recommended to create resources on both \u2018/\u2019 and\n\u2018/SOMEPREFIX\u2019 unless you don\u2019t need the \u2018/\u2019 route.\n\nA note about URL generation and redirection\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nIn order to properly execute things like URL generation and redirection,\nWSGI applications use an environment variable called SCRIPT_NAME. By default,\nthis works as one might expect. However, if your API is\n`mapped to a custom domain using base path mapping`_, you need to tell\nthe application about this. This is a common problem with more traditional\nsetups as well (e.g. applications behind a reverse proxy).\n\nThe solution in Sippy Cup is to `set a stage variable`_ called\nSIPPYCUP_SCRIPT_NAME_BASE, which will be used by Sippy Cup to properly construct\nSCRIPT_NAME so that things work as expected.\n\ne.g. If you are mapping your 'production' stage to api.mydomain.com using the default\nconfiguration in ApiGateway, you should set the 'SIPPYCUP_SCRIPT_NAME_BASE' stage\nvariable for that stage to '/'.\n\n.. _Python: https://www.python.org/\n.. _AWS API Gateway: https://aws.amazon.com/api-gateway/\n.. _AWS Lambda: https://aws.amazon.com/lambda/\n.. _WSGI: https://wsgi.readthedocs.io/en/latest/\n.. _create a deployment package: https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html\n.. _virtualenv: https://virtualenv.pypa.io/en/stable/\n.. _set up an API Gateway proxy resource with the lambda proxy integration: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html#api-gateway-set-up-lambda-proxy-integration-on-proxy-resource\n.. _mapped to a custom domain using base path mapping: http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html\n.. _set a stage variable: http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-set-stage-variables-aws-console.html", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/realsalmon/sippycup", "keywords": "aws lambda api serverless wsgi", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sippycup", "package_url": "https://pypi.org/project/sippycup/", "platform": "", "project_url": "https://pypi.org/project/sippycup/", "project_urls": { "Homepage": "https://github.com/realsalmon/sippycup" }, "release_url": "https://pypi.org/project/sippycup/0.6.0/", "requires_dist": null, "requires_python": "", "summary": "An adaptor for serving WSGI applications using AWS Lambda and API Gateway", "version": "0.6.0" }, "last_serial": 4272024, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "081379abc53e10405455a40526c4af17", "sha256": "bb82bfd53ba308e2a24962d7e899544e05dbe74dbeddba3a7c661460f7e83811" }, "downloads": -1, "filename": "sippycup-0.1.1.tar.gz", "has_sig": false, "md5_digest": "081379abc53e10405455a40526c4af17", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4327, "upload_time": "2016-11-09T00:59:45", "url": "https://files.pythonhosted.org/packages/fe/96/576e4eded44275a9ef19b20bcbd2919294454282ec919eef736506f510ad/sippycup-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "0a5d81be0a2bcff88bdd58ad2b5ca69e", "sha256": "5254e46709bc6a81bb6b9fb44ca63205512056b94044ec48e4e84c071a7efc63" }, "downloads": -1, "filename": "sippycup-0.2.0.tar.gz", "has_sig": false, "md5_digest": "0a5d81be0a2bcff88bdd58ad2b5ca69e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4424, "upload_time": "2016-11-10T02:32:29", "url": "https://files.pythonhosted.org/packages/a3/8e/079440897badb3e0570079a861f64a23fe8193beb9b5ce1a003f181ac151/sippycup-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "f54912ba2553de40ae13a6eaf124c2a6", "sha256": "07095b402bc5e1441029aebd4cf274e41ebbfcc72e661d59aba52078aea3d973" }, "downloads": -1, "filename": "sippycup-0.3.0.tar.gz", "has_sig": false, "md5_digest": "f54912ba2553de40ae13a6eaf124c2a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4727, "upload_time": "2016-11-16T22:40:11", "url": "https://files.pythonhosted.org/packages/a1/0b/88b59730cb9a1dc556ae93ab266c9ab7f156db2ed3eaf6582f963ad8288e/sippycup-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "f3962336feb39e7ddaacb46c813e1ab1", "sha256": "ed57ccdea7df53dc120e148b6a45dd042229690d278e101f357df4c52f0a794e" }, "downloads": -1, "filename": "sippycup-0.4.0.tar.gz", "has_sig": false, "md5_digest": "f3962336feb39e7ddaacb46c813e1ab1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3653, "upload_time": "2016-11-23T19:14:54", "url": "https://files.pythonhosted.org/packages/12/5e/d8c6889464ad79136accb9400438a1aaea2bc2ff87f43b58dedf949034a0/sippycup-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "9e22bb0fd2aac2193b4eb03486d65c66", "sha256": "6e51ffbd3ab59190651248a786dfc2d750e5f7e83b04e3f14507fc090806efd6" }, "downloads": -1, "filename": "sippycup-0.5.0.tar.gz", "has_sig": false, "md5_digest": "9e22bb0fd2aac2193b4eb03486d65c66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4466, "upload_time": "2017-08-14T16:10:05", "url": "https://files.pythonhosted.org/packages/87/47/4ec9829ccdf4d95972ba848df4a895e1f23ce7c9bb0d17383d030415bbd0/sippycup-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "3b6695baa30d581baa99a1ae3e70c1bc", "sha256": "ce1bf9ab6ebdb9574e344dfa783c0aa4a42ff99eb131b4446f9624de85e603d9" }, "downloads": -1, "filename": "sippycup-0.5.1.tar.gz", "has_sig": false, "md5_digest": "3b6695baa30d581baa99a1ae3e70c1bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4889, "upload_time": "2017-08-22T21:23:43", "url": "https://files.pythonhosted.org/packages/4c/c8/3e9f1309ef428419d60e194e48c1b39a4d646120933f00e2977b654bc4b9/sippycup-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "44ff47164d06c2713f20401b7b52d142", "sha256": "4f095c477548650c7726a7f0689a51a02496c4b08f57ea52ae7c0d7a5bc6a2c7" }, "downloads": -1, "filename": "sippycup-0.5.2.tar.gz", "has_sig": false, "md5_digest": "44ff47164d06c2713f20401b7b52d142", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4886, "upload_time": "2017-08-24T02:17:30", "url": "https://files.pythonhosted.org/packages/a4/22/68ff59d90ebce38c68d32051327b9942402d86f22df4eb6c49c411a0bff6/sippycup-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "6a11ec7ffaedb2e908d3f7d1594053bd", "sha256": "30abfcaae4c55c273ff6070f2701667e2e792ea0b04504a8091c0774f1bed6da" }, "downloads": -1, "filename": "sippycup-0.5.3.tar.gz", "has_sig": false, "md5_digest": "6a11ec7ffaedb2e908d3f7d1594053bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4896, "upload_time": "2017-08-27T02:07:32", "url": "https://files.pythonhosted.org/packages/8e/bb/d8d796cf0f7994e6206086daf53484f5caa5ec09af10f482047e492c556a/sippycup-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "54d25412fe28d6b8979fa31f88f85072", "sha256": "a75cc963261978932bfe425e8211aaf1238e25499e4f904d0c8255a8a40a5fff" }, "downloads": -1, "filename": "sippycup-0.5.4.tar.gz", "has_sig": false, "md5_digest": "54d25412fe28d6b8979fa31f88f85072", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4935, "upload_time": "2018-02-15T04:30:19", "url": "https://files.pythonhosted.org/packages/85/62/874dc523292c97a5b12262abadf436c7ad4f40263c924ac2e826fa351070/sippycup-0.5.4.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "b7a6b7f3a8377d7861b2572429573080", "sha256": "eb58e88d9e690eaaa6e35c4bf4a316593e643c087da433dde8e9d702984f114f" }, "downloads": -1, "filename": "sippycup-0.6.0.tar.gz", "has_sig": false, "md5_digest": "b7a6b7f3a8377d7861b2572429573080", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4872, "upload_time": "2018-09-14T11:33:04", "url": "https://files.pythonhosted.org/packages/cf/11/bd9e2deacd36cb84ae4a22b7d597aeef3e3a727a4fccd4e36e0ec8042d30/sippycup-0.6.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b7a6b7f3a8377d7861b2572429573080", "sha256": "eb58e88d9e690eaaa6e35c4bf4a316593e643c087da433dde8e9d702984f114f" }, "downloads": -1, "filename": "sippycup-0.6.0.tar.gz", "has_sig": false, "md5_digest": "b7a6b7f3a8377d7861b2572429573080", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4872, "upload_time": "2018-09-14T11:33:04", "url": "https://files.pythonhosted.org/packages/cf/11/bd9e2deacd36cb84ae4a22b7d597aeef3e3a727a4fccd4e36e0ec8042d30/sippycup-0.6.0.tar.gz" } ] }