{ "info": { "author": "Pat Ambrosio", "author_email": "patambrosio@me.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n[![CircleCI](https://circleci.com/gh/hmngwy/py-aws-lambda-handler.svg?style=svg)](https://circleci.com/gh/hmngwy/py-aws-lambda-handler) [![codecov](https://codecov.io/gh/hmngwy/py-aws-lambda-handler/branch/develop/graph/badge.svg)](https://codecov.io/gh/hmngwy/py-aws-lambda-handler)\n\n![](https://codecov.io/gh/hmngwy/py-aws-lambda-handler/branch/develop/graphs/tree.svg?height=70&width=898)\n\n## aws-lambda-handlers\n\nBetter Python 3 AWS Lambda Handlers.\n\nCurrently, your only choice for making Python handlers for AWS Lambda is to create a function like so:\n\n```\ndef handler(event, context):\n return True\n```\n\nThis isn't ideal when you start dealing with more than one handler, or if you want to provide a configurable and reusable handler. This package provides three base classes, the `Handler`, the `Request`, and the `Response` handler.\n\nThe `Handler` class is a [callable](https://en.wikipedia.org/wiki/Callable_object), you create a subclass off of this, instantiate it, and that's what you configure AWS\u03bb to invoke.\n\nYour `Handler` has to have a `perform(self, request)` method, this houses your handler's business logic, `Handler.__call__` executes this function and expects a `Response` object.\n\nThe `Response` object behaves like a dictionary and an object, an attribute called `serialized` is returned to AWS\u03bb.\n\nThe `request` argument in `perform(self, request)` is a `Request` object, and it houses the `event` and `context` parameters that AWS\u03bb passes to your handler. Packaging those handler arguments into an object makes them available for transparent mutations, see [`aws_lambda.apig.APIGatewayRequest`](py-aws-lambda-handler/aws_lambda/apig/\\_\\_init\\_\\_.py) for reference.\n\nThe foundation of this library is tiny, I recommend reviewing the [main classes](py-aws-lambda-handler/aws_lambda/__init__.py) to further understand how to use this package.\n\n### Usage\n\n```\npip install aws-lambda-handler\n```\n\n```python\nimport aws_lambda\n\nclass EchoHandler(aws_lambda.Handler):\n \"\"\"Echo handler.\"\"\"\n\n def perform(self, request, **k):\n \"\"\"Echo perform method.\"\"\"\n response = aws_lambda.Response()\n response.body = self.request.event\n return response\n\necho_handler = EchoHandler()\n\n# `echo_handler` is now a callable function you can map your AWS Lambda function to\n```\n\n### Develop\n\nFork this library and send over PRs, I will consider applications for contributors if two of your PRs gets merged and published.\n\n```\npipenv sync --dev # setup\npipenv run pytest # test\n```\n\n### Supported Event Sources\n\n- [x] API Gateway `aws_lambda.apig`\n- [ ] S3\n- [ ] DynamoDB\n- [ ] SNS\n- [ ] SES\n- [ ] SQS\n- [ ] Cognito\n- [ ] Cloudwatch Logs, Events\n\n#### Help\n\nWe want support for more event sources, I am willing to entertain PRs. You can use the `aws_lambda.apig` submodule as an example of implementing more event sources.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hmngwy/py-aws-lambda-handler/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "aws-lambda-handler", "package_url": "https://pypi.org/project/aws-lambda-handler/", "platform": "", "project_url": "https://pypi.org/project/aws-lambda-handler/", "project_urls": { "Homepage": "https://github.com/hmngwy/py-aws-lambda-handler/" }, "release_url": "https://pypi.org/project/aws-lambda-handler/0.0.4/", "requires_dist": [ "inflection", "simplejson", "namedtupled", "cached-property" ], "requires_python": ">=3.6.0", "summary": "Better AWS Lambda handlers.", "version": "0.0.4" }, "last_serial": 4358553, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d1535781b6b2d307ba7c09729da4b99a", "sha256": "0d71b1009398f5fe4d50988061a59f0e62891528107ee66f87b10c1eb1bdc915" }, "downloads": -1, "filename": "aws_lambda_handler-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d1535781b6b2d307ba7c09729da4b99a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 6178, "upload_time": "2018-10-09T11:06:23", "url": "https://files.pythonhosted.org/packages/46/ba/5421eb4c447e002ed5f83cc9df19e02c5b8f92c05f353e409cce66f18575/aws_lambda_handler-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "84beafc6b97f3fbeee9b8d7655ed6a0e", "sha256": "04acb1e938fa836756fbf4ffc06e9d3187bd3bf4367b049c8eff3362ead03ac1" }, "downloads": -1, "filename": "aws-lambda-handler-0.0.1.tar.gz", "has_sig": false, "md5_digest": "84beafc6b97f3fbeee9b8d7655ed6a0e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4219, "upload_time": "2018-10-09T11:06:24", "url": "https://files.pythonhosted.org/packages/b4/f9/e11c562f3c33c322c0fd775cce989c68dedaa1000dc65c896baa6153baf3/aws-lambda-handler-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "ec58ebaacf91032105e33279cfce2cc1", "sha256": "a04ad638702a615e0ef7ccddfe86abcd75a5c647c48d570e51342031d6b90bc5" }, "downloads": -1, "filename": "aws_lambda_handler-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ec58ebaacf91032105e33279cfce2cc1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 6728, "upload_time": "2018-10-09T11:26:01", "url": "https://files.pythonhosted.org/packages/63/66/e59e8ff7ffb7bc9191f0b0184675f9cda476fc242ed43b2ea4e2b82e2bea/aws_lambda_handler-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2daefd9c6f49c606b90329d5a74b8f8d", "sha256": "11b7c5d6e753fe029904447566c0e0ea41acbb0e5d790615e399d02fb6761c58" }, "downloads": -1, "filename": "aws-lambda-handler-0.0.2.tar.gz", "has_sig": false, "md5_digest": "2daefd9c6f49c606b90329d5a74b8f8d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4818, "upload_time": "2018-10-09T11:26:02", "url": "https://files.pythonhosted.org/packages/84/a3/7f54e8d169a3c9ec555b3ba29e3701f25ab026903c80cf0d2ec5907f7728/aws-lambda-handler-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "7bdf52706ec22917be66f6ab30a7a0f0", "sha256": "97905749d2c656fbfb6b34c6e23062e055c99b4a58806ecf890d34bd6fc3d945" }, "downloads": -1, "filename": "aws_lambda_handler-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7bdf52706ec22917be66f6ab30a7a0f0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 7437, "upload_time": "2018-10-09T17:59:49", "url": "https://files.pythonhosted.org/packages/c9/dc/196f408be56befaa48b7c4163d2404f39e450ce747c2e22c246205233020/aws_lambda_handler-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3d17400702250685e1376dd19d679182", "sha256": "1c02b482d83a38de72cc57e98e1bd1c6ce1ff9dbe338df27d348fb057f5378d8" }, "downloads": -1, "filename": "aws-lambda-handler-0.0.3.tar.gz", "has_sig": false, "md5_digest": "3d17400702250685e1376dd19d679182", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5579, "upload_time": "2018-10-09T17:59:50", "url": "https://files.pythonhosted.org/packages/1f/69/4129855238dca2c6a92c824cc9410876aeb070f761a08193dacdb4d25de7/aws-lambda-handler-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "9c7b43d8f36d84df894e96c6dc614b31", "sha256": "0a01707ff5a29d55fb1538e7a6aeb454607398baaeaa5f9f85e085fae5481899" }, "downloads": -1, "filename": "aws_lambda_handler-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9c7b43d8f36d84df894e96c6dc614b31", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 7435, "upload_time": "2018-10-10T03:43:33", "url": "https://files.pythonhosted.org/packages/14/ea/634bb11f92cd6c51f885387744e565f948bfc4f1d9efacf9e2667ed01cec/aws_lambda_handler-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4af8b2b077e9bca7abdf4b935ebe27f9", "sha256": "0b8e9ec830341687098648f958e5de7fbffcfd9979deaee5778b35c184939450" }, "downloads": -1, "filename": "aws-lambda-handler-0.0.4.tar.gz", "has_sig": false, "md5_digest": "4af8b2b077e9bca7abdf4b935ebe27f9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5555, "upload_time": "2018-10-10T03:43:35", "url": "https://files.pythonhosted.org/packages/36/05/63bf99ce53703e8a70883c4bcfcf68c95a8b50f199c23ce735e8bd712b95/aws-lambda-handler-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9c7b43d8f36d84df894e96c6dc614b31", "sha256": "0a01707ff5a29d55fb1538e7a6aeb454607398baaeaa5f9f85e085fae5481899" }, "downloads": -1, "filename": "aws_lambda_handler-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9c7b43d8f36d84df894e96c6dc614b31", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 7435, "upload_time": "2018-10-10T03:43:33", "url": "https://files.pythonhosted.org/packages/14/ea/634bb11f92cd6c51f885387744e565f948bfc4f1d9efacf9e2667ed01cec/aws_lambda_handler-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4af8b2b077e9bca7abdf4b935ebe27f9", "sha256": "0b8e9ec830341687098648f958e5de7fbffcfd9979deaee5778b35c184939450" }, "downloads": -1, "filename": "aws-lambda-handler-0.0.4.tar.gz", "has_sig": false, "md5_digest": "4af8b2b077e9bca7abdf4b935ebe27f9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5555, "upload_time": "2018-10-10T03:43:35", "url": "https://files.pythonhosted.org/packages/36/05/63bf99ce53703e8a70883c4bcfcf68c95a8b50f199c23ce735e8bd712b95/aws-lambda-handler-0.0.4.tar.gz" } ] }