{ "info": { "author": "Filipe Waitman", "author_email": "filwaitman@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent" ], "description": "[![Build Status](https://travis-ci.org/filwaitman/rest-api-lib-creator.svg?branch=master)](https://travis-ci.org/filwaitman/rest-api-lib-creator)\n\n## REST API lib creator\n\nREST API lib creator is a boilerplate-free way for creating libs for RESTful APIs (specially the ones created using [Django REST framework](https://github.com/encode/django-rest-framework) - but certainly adaptable for other frameworks).\n\n**NOTES**:\n* This is a port for a personal project I made for myself. It may or may not solve your needs (it solves mine).\n* This is still alpha. I opened this on GH just so I can see if this is something I should improve (or not).\n\n\n## Installation:\n\n```bash\npip install rest-api-lib-creator\n```\n\n## Examples:\n\n* The bare minimum for creating your own lib:\n```python\nfrom rest_api_lib_creator.core import ViewsetRestApiLib\n\n\nclass User(ViewsetRestApiLib):\n base_api_url = 'http://super.cool/api/users'\n```\n\n* With this you can play around with your API:\n```python\nusers = User.list() # Triggers a requests.get with url=http://super.cool/api/users\nisinstance(users[0], User)\n\nuser = User.create(first_name='Filipe', last_name='Waitman', email='filwaitman@gmail.com', photo=open('image.png', 'rb')) # Triggers a requests.post with url=http://super.cool/api/users and data={'first_name': 'Filipe', 'last_name': 'Waitman', 'email': 'filwaitman@gmail.com'} and files={'photo': }\n\n# Similarly to the call above you could create an empty object and save it:\nuser = User()\nuser.first_name = 'Filipe'\nuser.last_name = 'Waitman'\nuser.email = 'filwaitman@gmail.com'\nuser.photo = open('image.png', 'rb')\nuser.save() # Triggers a requests.post with url=http://super.cool/api/users and data={'first_name': 'Filipe', 'last_name': 'Waitman', 'email': 'filwaitman@gmail.com'} and files={'photo': }\n\nisinstance(user, User)\nprint(user.id) # Prints the user id (assuming the API returned this field)\nprint(user.first_name) # )rints the user first name (assuming the API returned this field)\nuser.first_name = 'New name'\nuser.save() # Triggers a requests.patch with url=http://super.cool/api/users/ and data={'first_name': 'New name'}\n\nuser.delete() # Triggers a requests.delete with url=http://super.cool/api/users/\n```\n\n* If your resource return other nested resources you can parse them as well:\n```python\nclass Pet(ViewsetRestApiLib):\n base_api_url = 'http://super.cool/api/pets'\n nested_objects = {\n 'owner': User,\n }\n\n\npet = Pet.retrieve('pet-id')\nisinstance(pet, Pet)\nisinstance(pet.owner, User)\n```\n\nYou can see all possible customizations [here](https://github.com/filwaitman/rest-api-lib-creator/blob/master/rest_api_lib_creator/core.py#L10-L30) (someday I'll improve this doc).\n\n## Special thanks:\n\n* [Django REST framework](https://github.com/encode/django-rest-framework) - you're the best, seriously.\n* [Stripe-python lib](https://github.com/stripe/stripe-python) - which I used as an inspiration to create this project.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/filwaitman/rest-api-lib-creator/tarball/0.1.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/filwaitman/rest-api-lib-creator", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "rest-api-lib-creator", "package_url": "https://pypi.org/project/rest-api-lib-creator/", "platform": "", "project_url": "https://pypi.org/project/rest-api-lib-creator/", "project_urls": { "Download": "https://github.com/filwaitman/rest-api-lib-creator/tarball/0.1.1", "Homepage": "https://github.com/filwaitman/rest-api-lib-creator" }, "release_url": "https://pypi.org/project/rest-api-lib-creator/0.1.1/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "Boilerplate-free way for creating libs for REST APIs", "version": "0.1.1" }, "last_serial": 4653692, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "4ccfd7212a4d5d2a6d5549c18e47017a", "sha256": "3a6e1d4e79bb8fb15adc4befdf5cba2134ae0fdbc03525308c4df2000450f8e7" }, "downloads": -1, "filename": "rest_api_lib_creator-0.1.0-py3.6.egg", "has_sig": false, "md5_digest": "4ccfd7212a4d5d2a6d5549c18e47017a", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 4162, "upload_time": "2018-12-21T19:02:54", "url": "https://files.pythonhosted.org/packages/e2/78/067c6ec571e863c56990283ee6414337c416b5ba7d36957880b888c64259/rest_api_lib_creator-0.1.0-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "4a8e1e87fd4086fb4304572793533567", "sha256": "a7ba1ce02e1cc085bf219ea1600b6e7627843b8d78e70603cdde6dcce2bce8f1" }, "downloads": -1, "filename": "rest_api_lib_creator-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4a8e1e87fd4086fb4304572793533567", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6888, "upload_time": "2018-12-21T19:02:52", "url": "https://files.pythonhosted.org/packages/78/ab/3d1b17b59d200c7409a9557cfdae353a1380c65f16b915e12fbaab041593/rest_api_lib_creator-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f2e5908b456461e19ff424d43a77bca6", "sha256": "7d90b849d64e6f810957c3a6b5819adcdc7908bc6dafda3dc02f74feff720bfc" }, "downloads": -1, "filename": "rest-api-lib-creator-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f2e5908b456461e19ff424d43a77bca6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17629, "upload_time": "2018-12-21T19:02:55", "url": "https://files.pythonhosted.org/packages/71/f2/0862bbeb68cfc697b5dd7473b6ddefe13866d33c31b1c3abc1803b58ec85/rest-api-lib-creator-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3fd87f0df50099f0976656080e9e7c2f", "sha256": "0bf49b00902e6d75d84b1c4401cba89a49c8d18e55ed902e4956dd514c3f5a3f" }, "downloads": -1, "filename": "rest_api_lib_creator-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3fd87f0df50099f0976656080e9e7c2f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7005, "upload_time": "2019-01-02T18:42:50", "url": "https://files.pythonhosted.org/packages/e1/d5/8a3b03ffbf8530a543ca0928724cc6837f10b93661a3d63173e2f9d92d71/rest_api_lib_creator-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a5df85f4be98e5c6647feba6233f6c6", "sha256": "14d815962d6a68523d0beeb2524292ca7c9415965d7c78acb33a423a688e8aff" }, "downloads": -1, "filename": "rest-api-lib-creator-0.1.1.tar.gz", "has_sig": false, "md5_digest": "4a5df85f4be98e5c6647feba6233f6c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18106, "upload_time": "2019-01-02T18:43:48", "url": "https://files.pythonhosted.org/packages/c6/6e/ce9f2e59e6eddbf11669c1135cf941c0ef0afc5b85fa5c1697ba6618dce8/rest-api-lib-creator-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3fd87f0df50099f0976656080e9e7c2f", "sha256": "0bf49b00902e6d75d84b1c4401cba89a49c8d18e55ed902e4956dd514c3f5a3f" }, "downloads": -1, "filename": "rest_api_lib_creator-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "3fd87f0df50099f0976656080e9e7c2f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7005, "upload_time": "2019-01-02T18:42:50", "url": "https://files.pythonhosted.org/packages/e1/d5/8a3b03ffbf8530a543ca0928724cc6837f10b93661a3d63173e2f9d92d71/rest_api_lib_creator-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4a5df85f4be98e5c6647feba6233f6c6", "sha256": "14d815962d6a68523d0beeb2524292ca7c9415965d7c78acb33a423a688e8aff" }, "downloads": -1, "filename": "rest-api-lib-creator-0.1.1.tar.gz", "has_sig": false, "md5_digest": "4a5df85f4be98e5c6647feba6233f6c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18106, "upload_time": "2019-01-02T18:43:48", "url": "https://files.pythonhosted.org/packages/c6/6e/ce9f2e59e6eddbf11669c1135cf941c0ef0afc5b85fa5c1697ba6618dce8/rest-api-lib-creator-0.1.1.tar.gz" } ] }