{ "info": { "author": "Carlos de las Heras - Foqum", "author_email": "info@foqum.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Build Tools" ], "description": "[![Build Status](https://travis-ci.org/QuantumBA/pyverless.svg?branch=master)](https://travis-ci.org/QuantumBA/pyverless)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pyverless.svg)](https://pypi.python.org/pypi/pyverless/)\n[![PyPI license](https://img.shields.io/pypi/l/pyverless.svg)](https://pypi.python.org/pypi/pyverless/)\n[![PyPI status](https://img.shields.io/pypi/status/pyverless.svg)](https://pypi.python.org/pypi/pyverless/)\n# Pyverless\n\nDeveloping complex APIs within AWS lambdas can be somewhat of a messy task. Lambdas are independent functions that have to work together in order to create a full-blown app, like atoms to a complex organism.\n\nIn order to define the infrastructure you may use a framework like [Serverless](https://serverless.com/), but you may find yourself copying and pasting blobs of code within your handler functions, namely for authentication, data validation, error handling and response creation to name a few.\n\n**Enter Pyverless**\n\nPyverless is a mini-framework with a bunch of utilities that aims to help you create APIs using AWS Lambdas fast and in a consistent way. Pyverless provides the following.\n\n- Class-Based Handlers\n- Serializers\n- Authentication handling\n- JWT and cryptography\n- Exceptions\n- Configuration\n- Warmup handling\n\nBring more consistency and development speed to your lambda-based APIs!\n\n## Class-Based Handlers\n\nClass based handlers (CBH) use the approach of Django's Class-Based Views to provide code reuse, consistency and generally abstract simple and common tasks. The aim of class-based handlers is to suit a wide range of applications by providing generic Handler classes and mixins.\n\nWithin AWS Lambda, a handler is a function that takes an event and a context and returns a response.\n\nGeneric CBH are based off the following base handler\n\n### BaseHandler\n\nThis class provides the `as_handler()` method that returns a handler function (taking `event` and `context` as arguments).\n\nUsage:\n\n```python\nclass MyHandler(BaseHandler):\n pass\n\n_myHandler = MyHandler.as_handler()\n```\n\nThere is a set of generic CBHs to handle basic CRUD operations within an API:\n\n### CreateHandler\nHandler that reads the request body and creates the object with each (key, value) pair as a parameter for the constructor.\n\nThe `model` attribute must be set on the handler and the `create_object` method can be overwritten.\n\nUsage:\n\n```python\nclass UserCreateHandler(CreateHandler):\n\n model = MyUserClass # MyUserClass(k1=v1, k2=v2, ...) for each k,v on body\n required_body_keys = ['email', 'password']\n```\n\n### RetrieveHandler\nHandler that returns a serialized Object.\n\nThe `model` attribute must be set and `id` must be present on the pathParameters.\n\nThe user must overwrite either the `serializer` attribute or the `serialize` method.\n\nUsage:\n\n```python\nclass UserRetrieveHandler(RetrieveHandler):\n\n model = MyUserClass\n serializer = serialize_user\n```\n\n### UpdateHandler\nHandler that sets self.object and for each (key, value) pair of the body\nsets self.object.key = value.\n\nThe `model` attribute must be set and `id` must be present on the pathParameters.\n\nReturns the serialized node and sets the HTTP status code to 200\n\nUsage:\n\n```python\nclass UserUpdateHandler(UpdateHandler):\n model = MyUserClass\n required_body_keys = ['title', 'body']\n serializer = serialize_user\n```\n\n\n### DeleteHandler\nHandler that sets self.object, calls its delete() method and sets the HTTP status code to 204.\n\nThe `model` attribute must be set and `id` must be present on the pathParameters.\n\nThe user can also overwrite the `get_queryset` method to limit the search.\n\nUsage:\n\n```python\nclass UserDeleteHandler(DeleteHandler):\n model = MyUserClass\n```\n### ListHandler\nHandler that returns a list of serialized nodes and sets the HTTP status code to 200.\n\nThe `model` attribute must be set and the user must overwrite either the `serializer` attribute\nor the `serialize` method.\n\n```python\nclass UserListHandler(ListHandler):\n model = MyUserClass\n serializer = user_serializer\n\n def get_queryset(self):\n return only_some_users\n```\n\n## Mixins\nThere are also a set of **mixins** available:\n\n### RequestBodyMixin\n\nThis mixin provides the `get_body()` method which is in charge of gathering the request body dictionary. Define `required_body_keys` and `optinal_body_keys` as follows. Within the handler, you can access the body via `self.body` or by calling `get_body()`\n\n```python\nclass MyHandler(RequestBodyMixin, BaseHandler):\n required_body_keys = ['name', 'email']\n optinal_body_keys = ['phone']\n\n_myHandler = MyHandler.as_handler()\n```\n\n### AuthorizationMixin\n\nThis mixin provides the `get_user()` method in charge of getting the user out of an authenticated API call.\nWithin the handler, you can access the body via `self.body` or by calling `get_user()`. The user will be a object\nof the class specified on pyverless settings as `USER_MODEL`.\n\n### RequestBodyMixin\n\nThis mixin provides the `get_object()` method in charge of gathering a particular object,\nyou can access the object via `self.object`.\nThe `id` of the object will be taken from the pathParameters and\nthe user must set the `model` attribute on the handler.\n\n### ListMixin\n\nThis mixin provides the `get_queryset()` method in charge of getting a list of objects,\nyou can access the list via `self.queryset`. The user must set the `model` attribute\nand either the `serializer` attribute or `serialize()` method on the handler.\n\n### S3FileMixin\n\nThis mixin provides the `get_file()` and `get_message_part()` methods in charge of\nreading an event from aws S3, you can access the file via `self.file`.\n\nThe file will be a `dict()` with the following keys: bucket, owner, file_name, size.\n\n***Warning: Only tested with objectCreated!!!!***\n\n### SQSMessagesMixin\n\nThis mixin provides the `get_messages()` method in charge of reading an SQS event from aws.\nYou can access the list of messages via `self.messages`.\n\nEach message will be a `dict()` with the following keys: attributes, text_message, queue_source, region.\n\n## Serializers\n\n**TODO**\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/QuantumBA/pyverless", "keywords": "serverless api development", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "pyverless", "package_url": "https://pypi.org/project/pyverless/", "platform": "", "project_url": "https://pypi.org/project/pyverless/", "project_urls": { "Homepage": "https://github.com/QuantumBA/pyverless" }, "release_url": "https://pypi.org/project/pyverless/0.0.6/", "requires_dist": [ "PyJWT (==1.5.2)", "PyYAML (==3.12)", "sentry-sdk (==0.5.1)", "check-manifest ; extra == 'dev'", "coverage ; extra == 'test'", "pytest ; extra == 'test'" ], "requires_python": ">=3", "summary": "A mini-framework providing tools to help you make complex APIs with serverless", "version": "0.0.6" }, "last_serial": 5181287, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "6c90fd1c67661e7b0b294a596857f90a", "sha256": "009d89b0be75edb73c30ee76536e2116de71c9f526f13571bd60755d0b6ea887" }, "downloads": -1, "filename": "pyverless-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6c90fd1c67661e7b0b294a596857f90a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 12000, "upload_time": "2018-11-21T08:35:15", "url": "https://files.pythonhosted.org/packages/e2/6d/64f246c31114327b075c170360273f5769098369bf4bfeea36389427443b/pyverless-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9cb8a86436e116da50db6eaee28226a5", "sha256": "39289ac91422f9eeaeb050dcc816069efcb79e5bab77f1ae9f05e5f7314cd403" }, "downloads": -1, "filename": "pyverless-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9cb8a86436e116da50db6eaee28226a5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 10619, "upload_time": "2018-11-21T08:35:17", "url": "https://files.pythonhosted.org/packages/04/63/c194699a720a55c42f1206c9f4dac388ad0e9336566fe99467df29774ce1/pyverless-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f14791201c39e0bcb335590e0375db83", "sha256": "5bc8f57ba343e2ea2558d314de9eeab91499dd68d09e7e01523db843e6447470" }, "downloads": -1, "filename": "pyverless-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f14791201c39e0bcb335590e0375db83", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 12074, "upload_time": "2018-11-21T09:15:28", "url": "https://files.pythonhosted.org/packages/6c/0f/cf332848364f41f03c42f5e6a8d7153def6ae9b68584bb9d346f4b7af284/pyverless-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0b1cff0e19c68bb0d03949a4039591f6", "sha256": "d03883ec73596e614c3296695a4ede9bb7f253f8aceb2f4d76334cee8c12e96e" }, "downloads": -1, "filename": "pyverless-0.0.2.tar.gz", "has_sig": false, "md5_digest": "0b1cff0e19c68bb0d03949a4039591f6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 10705, "upload_time": "2018-11-21T09:15:29", "url": "https://files.pythonhosted.org/packages/59/5b/ab9d00f61cb74d0b28947d1a89e3fe2d1448dc0cb8866200ae2975290c2a/pyverless-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "aef5c4da4a79b984e16056421f7f65a1", "sha256": "677c19ba30c7d0df2ef357ad93ea7c8cc8accdd6407b412b0b4d4920651ef079" }, "downloads": -1, "filename": "pyverless-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "aef5c4da4a79b984e16056421f7f65a1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 12197, "upload_time": "2018-11-21T16:05:46", "url": "https://files.pythonhosted.org/packages/39/df/b33c4cc3130bfb995af34e41f62ef5cd77b23c20132abf6c61f341bd04c9/pyverless-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "afcda6921001bc8b0b770c34923e4dfb", "sha256": "d27111559a2b15d2568b52558dd91243448232af47c04bc0898af20f86fdf47b" }, "downloads": -1, "filename": "pyverless-0.0.3.tar.gz", "has_sig": false, "md5_digest": "afcda6921001bc8b0b770c34923e4dfb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 10831, "upload_time": "2018-11-21T16:05:47", "url": "https://files.pythonhosted.org/packages/cd/0c/be3471f9039223505d8f9202085f22d980cffaaebce7215c8922f2b26258/pyverless-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "6c4392bf14240356613e9529de26a369", "sha256": "edba37055662df8c9a730ec1312b24749e7e6cd3aa446996c2dbf6d227b329cb" }, "downloads": -1, "filename": "pyverless-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "6c4392bf14240356613e9529de26a369", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 13527, "upload_time": "2019-04-24T09:36:16", "url": "https://files.pythonhosted.org/packages/95/a6/e57b0c17b7587ba20b2e133fcd5514d2d861490c38ba517ef51e04500433/pyverless-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de90f0bfc3ea7d05d48c98de588a4b09", "sha256": "29c69411ef325b04d4646d350fcf04b6f589be37e637e8c27571c1698251c4bf" }, "downloads": -1, "filename": "pyverless-0.0.4.tar.gz", "has_sig": false, "md5_digest": "de90f0bfc3ea7d05d48c98de588a4b09", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14182, "upload_time": "2019-04-24T09:36:13", "url": "https://files.pythonhosted.org/packages/b3/c3/4403ea7517ea01a3d4febad00a8b829cbc67d4776ee1322ea016c68cb7d5/pyverless-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "5d6bbbac456f451b5a5b7383aee6f7a0", "sha256": "f3d5b57ae35dd37a0949f017dc657ab9bc6692c08532dd07dfebc0ba2f133b54" }, "downloads": -1, "filename": "pyverless-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "5d6bbbac456f451b5a5b7383aee6f7a0", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 13556, "upload_time": "2019-04-24T09:41:12", "url": "https://files.pythonhosted.org/packages/98/5b/56af0172d7907ea7262dc5a9065d619510b32c4f28c40db49ccb121f42c8/pyverless-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a0409afb701e0edc7cdfc38bec2daf26", "sha256": "135acfe2922cdd26c223ab95f635ff6de13ac00e77e8a27ce54124bd780f1a35" }, "downloads": -1, "filename": "pyverless-0.0.5.tar.gz", "has_sig": false, "md5_digest": "a0409afb701e0edc7cdfc38bec2daf26", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14245, "upload_time": "2019-04-24T09:41:10", "url": "https://files.pythonhosted.org/packages/06/aa/f8620d508857c12df4d4b378a7ed51f9b2d8c09477c289bda53f2019b2ef/pyverless-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "9a232dbbfb9d8526d974b031d7f5fa1c", "sha256": "c0819ea09dfef2f4fdcc467b5c1707b99a813ddb0b1ed61953efe33b27ad9442" }, "downloads": -1, "filename": "pyverless-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "9a232dbbfb9d8526d974b031d7f5fa1c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 13557, "upload_time": "2019-04-24T09:57:25", "url": "https://files.pythonhosted.org/packages/ca/e1/f098d61aba0366984d6be42d836d93ac6cef8434663422283a8604c02f0d/pyverless-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "03be673f6fff92e9c4729d46a4e8cb96", "sha256": "625a16a86c8c0af4bc4f2181f4871586f8fd0ab1a9b87bae3a5b787af089bd64" }, "downloads": -1, "filename": "pyverless-0.0.6.tar.gz", "has_sig": false, "md5_digest": "03be673f6fff92e9c4729d46a4e8cb96", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 14247, "upload_time": "2019-04-24T09:57:27", "url": "https://files.pythonhosted.org/packages/46/8b/16ddcab6121f446a48ce911937dafe528ebd8022b296a1a40bca7c66a847/pyverless-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9a232dbbfb9d8526d974b031d7f5fa1c", "sha256": "c0819ea09dfef2f4fdcc467b5c1707b99a813ddb0b1ed61953efe33b27ad9442" }, "downloads": -1, "filename": "pyverless-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "9a232dbbfb9d8526d974b031d7f5fa1c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 13557, "upload_time": "2019-04-24T09:57:25", "url": "https://files.pythonhosted.org/packages/ca/e1/f098d61aba0366984d6be42d836d93ac6cef8434663422283a8604c02f0d/pyverless-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "03be673f6fff92e9c4729d46a4e8cb96", "sha256": "625a16a86c8c0af4bc4f2181f4871586f8fd0ab1a9b87bae3a5b787af089bd64" }, "downloads": -1, "filename": "pyverless-0.0.6.tar.gz", "has_sig": false, "md5_digest": "03be673f6fff92e9c4729d46a4e8cb96", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 14247, "upload_time": "2019-04-24T09:57:27", "url": "https://files.pythonhosted.org/packages/46/8b/16ddcab6121f446a48ce911937dafe528ebd8022b296a1a40bca7c66a847/pyverless-0.0.6.tar.gz" } ] }