{ "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/mutton.svg?style=svg)](https://circleci.com/gh/hmngwy/mutton) [![codecov](https://codecov.io/gh/hmngwy/mutton/branch/develop/graph/badge.svg)](https://codecov.io/gh/hmngwy/mutton)\n\n![](https://codecov.io/gh/hmngwy/mutton/branch/develop/graphs/tree.svg?height=70&width=898)\n\n## muttons\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 [`mutton.apig.APIGatewayRequest`](mutton/mutton/apig/\\_\\_init\\_\\_.py) for reference.\n\nThe foundation of this library is tiny, I recommend reviewing the [main classes](mutton/mutton/__init__.py) to further understand how to use this package.\n\n### Usage\n\n```\npip install mutton\n```\n\n```python\nimport mutton\n\nclass EchoHandler(mutton.Handler):\n \"\"\"Echo handler.\"\"\"\n\n def perform(self, request, **k):\n \"\"\"Echo perform method.\"\"\"\n response = mutton.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 `mutton.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 `mutton.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/mutton/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "mutton", "package_url": "https://pypi.org/project/mutton/", "platform": "", "project_url": "https://pypi.org/project/mutton/", "project_urls": { "Homepage": "https://github.com/hmngwy/mutton/" }, "release_url": "https://pypi.org/project/mutton/0.0.5/", "requires_dist": [ "inflection", "simplejson", "namedtupled", "cached-property" ], "requires_python": ">=3.6.0", "summary": "Better AWS Lambda handlers.", "version": "0.0.5" }, "last_serial": 4402287, "releases": { "0.0.4": [ { "comment_text": "", "digests": { "md5": "0bb8347e17ffb4ce87467d1f52206e0e", "sha256": "38d18b2edefa8cfa4ac2a925a75b2f24bb4aea147e7d59a0091612b7656403f6" }, "downloads": -1, "filename": "mutton-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0bb8347e17ffb4ce87467d1f52206e0e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 9642, "upload_time": "2018-10-22T13:57:09", "url": "https://files.pythonhosted.org/packages/22/11/7158840fad52bac7e0f58458962c1619e6531b5cd96b6baf4724a53319cd/mutton-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ccabfd39ce14dc7a86ba8b487a1516b9", "sha256": "1b7dd20e5f76d0ceb1f95afe7a211c2fce9cc69314fe706894895d98b9eb63bc" }, "downloads": -1, "filename": "mutton-0.0.4.tar.gz", "has_sig": false, "md5_digest": "ccabfd39ce14dc7a86ba8b487a1516b9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5533, "upload_time": "2018-10-22T13:57:11", "url": "https://files.pythonhosted.org/packages/df/c1/c0f1655c33d0fc48dafe8ca17d6cb1ab0b60d2cd15905f925d2d9e17a514/mutton-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "439b9c7997b3f8a5dd9f01ebe5a5568b", "sha256": "d23b3c4580fa0b0ea4ea7b5c841e9168c019ed25beb6f304a344b8e14a6f41c3" }, "downloads": -1, "filename": "mutton-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "439b9c7997b3f8a5dd9f01ebe5a5568b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 9643, "upload_time": "2018-10-22T13:58:44", "url": "https://files.pythonhosted.org/packages/8c/0f/17d5d23181cac6772f819ac8a4f279b2ddcd5f9105e483098efeeee0b0ca/mutton-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2b1782f01997278c401b631a898260fc", "sha256": "1b16ad8ac4e029e5d3fb862c9caf45438a87a632a0ac5420b3e4e91f14ad20e3" }, "downloads": -1, "filename": "mutton-0.0.5.tar.gz", "has_sig": false, "md5_digest": "2b1782f01997278c401b631a898260fc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5534, "upload_time": "2018-10-22T13:58:46", "url": "https://files.pythonhosted.org/packages/8d/3f/361a058a6ecd87b0b46835d037d20d73e5f51fa4b71df6f12d828ead95cd/mutton-0.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "439b9c7997b3f8a5dd9f01ebe5a5568b", "sha256": "d23b3c4580fa0b0ea4ea7b5c841e9168c019ed25beb6f304a344b8e14a6f41c3" }, "downloads": -1, "filename": "mutton-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "439b9c7997b3f8a5dd9f01ebe5a5568b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 9643, "upload_time": "2018-10-22T13:58:44", "url": "https://files.pythonhosted.org/packages/8c/0f/17d5d23181cac6772f819ac8a4f279b2ddcd5f9105e483098efeeee0b0ca/mutton-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2b1782f01997278c401b631a898260fc", "sha256": "1b16ad8ac4e029e5d3fb862c9caf45438a87a632a0ac5420b3e4e91f14ad20e3" }, "downloads": -1, "filename": "mutton-0.0.5.tar.gz", "has_sig": false, "md5_digest": "2b1782f01997278c401b631a898260fc", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 5534, "upload_time": "2018-10-22T13:58:46", "url": "https://files.pythonhosted.org/packages/8d/3f/361a058a6ecd87b0b46835d037d20d73e5f51fa4b71df6f12d828ead95cd/mutton-0.0.5.tar.gz" } ] }