{ "info": { "author": "Gimi Lin", "author_email": "120549827@qq.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "\n\n## sanic-restful\n\n### Simple framework for creating REST APIs\n\n# introduce\n\nAfter writing Sanic for a long time, I found that there was no framework similar to flask-restful, so I wrote one myself.\n\n[flask-restful](https://github.com/flask-restful/flask-restful)\n\n## Installation\n```linux\npip install sanic-restful-api\n```\n\n## Simple uses\n```python\nfrom sanic import Sanic\nfrom sanic_restful_api import reqparse, abort, Api, Resource\n\napp = Sanic(__name__)\napi = Api(app)\n\nTODOS = {\n 'todo1': {'task': 'build an API'},\n 'todo2': {'task': '?????'},\n 'todo3': {'task': 'profit!'},\n}\n\n\ndef abort_if_todo_doesnt_exist(todo_id):\n if todo_id not in TODOS:\n abort(404, message=\"Todo {} doesn't exist\".format(todo_id))\n\n\nparser = reqparse.RequestParser()\nparser.add_argument('task')\n\n# Todo\n# show a single todo item and lets you delete them\n\n\nclass Todo(Resource):\n async def get(self, request, todo_id):\n abort_if_todo_doesnt_exist(todo_id)\n return TODOS[todo_id]\n\n async def delete(self, request, todo_id):\n abort_if_todo_doesnt_exist(todo_id)\n del TODOS[todo_id]\n return '', 204\n\n async def put(self, request, todo_id):\n args = parser.parse_args(request)\n task = {'task': args['task']}\n TODOS[todo_id] = task\n return task, 201\n\n\n# TodoList\n# shows a list of all todos, and lets you POST to add new tasks\nclass TodoList(Resource):\n async def get(self, request):\n return TODOS\n\n async def post(self, request):\n args = parser.parse_args(request)\n todo_id = 'todo%d' % (len(TODOS) + 1)\n TODOS[todo_id] = {'task': args['task']}\n return TODOS[todo_id], 201\n\n\n##\n# Actually setup the Api resource routing here\n##\napi.add_resource(TodoList, '/todos')\napi.add_resource(Todo, '/todos/')\n\n\nif __name__ == '__main__':\n app.run(debug=True)\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/linzhiming0826/sanic-restful", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "sanic-restful-api", "package_url": "https://pypi.org/project/sanic-restful-api/", "platform": "any", "project_url": "https://pypi.org/project/sanic-restful-api/", "project_urls": { "Homepage": "https://github.com/linzhiming0826/sanic-restful" }, "release_url": "https://pypi.org/project/sanic-restful-api/0.0.6/", "requires_dist": [ "aniso8601 (>=0.82)", "sanic (>=18.2)", "six (>=1.3.0)", "pytz" ], "requires_python": "", "summary": "Simple framework for creating REST APIs", "version": "0.0.6" }, "last_serial": 5817833, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4aa66d6cb046b30503be4249660f44ea", "sha256": "8dc11e90a9e8f12e6a214a44ee62bbd91ee7deab2047a3792c752aca5ae589ee" }, "downloads": -1, "filename": "sanic_restful_api-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4aa66d6cb046b30503be4249660f44ea", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 57696, "upload_time": "2019-09-09T10:58:54", "url": "https://files.pythonhosted.org/packages/62/a9/5947e9b4c2d05d7bea5340c20b23c345a408af49139d9c5094972c7b9625/sanic_restful_api-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e3f4e265e1f27d691cdafb6cc4ee57a7", "sha256": "a80968106b1a63633b8a9e7fd55d71c6c78a5963cdd5023556c265ea648ebc85" }, "downloads": -1, "filename": "sanic_restful_api-0.0.1.tar.gz", "has_sig": false, "md5_digest": "e3f4e265e1f27d691cdafb6cc4ee57a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33245, "upload_time": "2019-09-09T10:58:57", "url": "https://files.pythonhosted.org/packages/52/c5/af09fd046473444525aec4e656b9f4a7a97c1123092770ecbae5e5f11ffb/sanic_restful_api-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "4b94e34dc74f4a7a587cbbe1692796c5", "sha256": "01fe762250db082252a62f51941ca62767bc1b97c6987b4e5b3073e76264b992" }, "downloads": -1, "filename": "sanic_restful_api-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4b94e34dc74f4a7a587cbbe1692796c5", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 57557, "upload_time": "2019-09-10T02:37:11", "url": "https://files.pythonhosted.org/packages/c2/29/87b8db30c3a63c32cff9c73cb6b47548a2c1438b898b66388eead6f60492/sanic_restful_api-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "597306923bdd521e7f1cf59e89e33903", "sha256": "53815a1029618c3110ee6255e0dc062c2a4d1f0fc5288285662d105f675f9fee" }, "downloads": -1, "filename": "sanic-restful-api-0.0.2.tar.gz", "has_sig": false, "md5_digest": "597306923bdd521e7f1cf59e89e33903", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33085, "upload_time": "2019-09-10T02:35:51", "url": "https://files.pythonhosted.org/packages/ce/63/ddc050696029aec9f80d18361bb0800f8db14dbab88e249202d15c6a943e/sanic-restful-api-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "40ef54d356449b7f9c2dde007fcdeac0", "sha256": "136baf714d143eed3d8c47d084cc17336fb47fc178615f3c69f4f571f674d9c2" }, "downloads": -1, "filename": "sanic_restful_api-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "40ef54d356449b7f9c2dde007fcdeac0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 58295, "upload_time": "2019-09-10T03:03:22", "url": "https://files.pythonhosted.org/packages/f5/28/ae4fc8fa2d8032b3887c994fcf9a8afeb6527793dc40c17351fc875dab4c/sanic_restful_api-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a47c8714519441d941a31e6107c9f2a", "sha256": "591124ab79a51dc534a3563ff079b8ff58cd0195339c32be7119e529bbdd6300" }, "downloads": -1, "filename": "sanic-restful-api-0.0.3.tar.gz", "has_sig": false, "md5_digest": "3a47c8714519441d941a31e6107c9f2a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33847, "upload_time": "2019-09-10T03:03:25", "url": "https://files.pythonhosted.org/packages/ac/cc/c3b342bf28e150025768b1140a8d2cea9e01822c0bebd56ced853af168fb/sanic-restful-api-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "a2977263a10c2e75ed54b6c658eda90a", "sha256": "1ee39e403c04e4658c115da39bc54ca0ec2019b23bfa2660c4346d806713ff07" }, "downloads": -1, "filename": "sanic_restful_api-0.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a2977263a10c2e75ed54b6c658eda90a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 58238, "upload_time": "2019-09-10T09:43:38", "url": "https://files.pythonhosted.org/packages/14/10/245fcc0c27b286cc085dfa7718ded7408abbf0a3a710ad79374b3531edb7/sanic_restful_api-0.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3fa83c091316b7789d23b6cb90b3a1cd", "sha256": "aecacaaad7c5a764230fe947f1bca8398ad919311d587d940eb412e14ca5618c" }, "downloads": -1, "filename": "sanic-restful-api-0.0.4.tar.gz", "has_sig": false, "md5_digest": "3fa83c091316b7789d23b6cb90b3a1cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33795, "upload_time": "2019-09-10T09:43:39", "url": "https://files.pythonhosted.org/packages/41/ff/6c98874b59d8f84345b0be4742fa3af22547d9f6bd6afd78549becbf6686/sanic-restful-api-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "c85ba470b36d5dd027e56cabeaf2717a", "sha256": "b5910c02aa7cdbb5d828d226ac634ce09ce35587e10b31efadc679f47b5a0385" }, "downloads": -1, "filename": "sanic_restful_api-0.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c85ba470b36d5dd027e56cabeaf2717a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 58239, "upload_time": "2019-09-10T09:44:20", "url": "https://files.pythonhosted.org/packages/bf/60/2953fe7bc8658e1db33cdc3b85fdedd7de1acabcdb184368e2cbd9f466cb/sanic_restful_api-0.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eabce65aa666affe94b5af89953e705e", "sha256": "edb0fc6f8e77a3f9c7b670cc6af67049b444d1b5262648729fecb50a9e83e300" }, "downloads": -1, "filename": "sanic-restful-api-0.0.5.tar.gz", "has_sig": false, "md5_digest": "eabce65aa666affe94b5af89953e705e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33805, "upload_time": "2019-09-10T09:44:22", "url": "https://files.pythonhosted.org/packages/7c/df/72cbfd9cdd5c785481a53ac0e60f71310d5f02d1979d6e552f7a9fa381ed/sanic-restful-api-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "df90d5e93514e0e433209c6fbe3bac85", "sha256": "f5e3fefec907fdf1cb792365b0bf52f7f52760d649ec36c5deaad183829e9004" }, "downloads": -1, "filename": "sanic_restful_api-0.0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "df90d5e93514e0e433209c6fbe3bac85", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 58236, "upload_time": "2019-09-12T02:19:10", "url": "https://files.pythonhosted.org/packages/86/48/b5798768bfd117129bbf0765bd3423879d5cc886c18f0ad7a08ed9719ef4/sanic_restful_api-0.0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e04a17b9067268375b61cb569c3f1306", "sha256": "18a86c0dc9acf0d4b004c7f5fca8eed4c83b6192998edb4671921d1099e8169e" }, "downloads": -1, "filename": "sanic-restful-api-0.0.6.tar.gz", "has_sig": false, "md5_digest": "e04a17b9067268375b61cb569c3f1306", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33805, "upload_time": "2019-09-12T02:19:12", "url": "https://files.pythonhosted.org/packages/55/a5/552ef3189764c2a686ea34b2de7063ec7bfa726a9c8ec8d2c02f21d1c7f3/sanic-restful-api-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "df90d5e93514e0e433209c6fbe3bac85", "sha256": "f5e3fefec907fdf1cb792365b0bf52f7f52760d649ec36c5deaad183829e9004" }, "downloads": -1, "filename": "sanic_restful_api-0.0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "df90d5e93514e0e433209c6fbe3bac85", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 58236, "upload_time": "2019-09-12T02:19:10", "url": "https://files.pythonhosted.org/packages/86/48/b5798768bfd117129bbf0765bd3423879d5cc886c18f0ad7a08ed9719ef4/sanic_restful_api-0.0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e04a17b9067268375b61cb569c3f1306", "sha256": "18a86c0dc9acf0d4b004c7f5fca8eed4c83b6192998edb4671921d1099e8169e" }, "downloads": -1, "filename": "sanic-restful-api-0.0.6.tar.gz", "has_sig": false, "md5_digest": "e04a17b9067268375b61cb569c3f1306", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33805, "upload_time": "2019-09-12T02:19:12", "url": "https://files.pythonhosted.org/packages/55/a5/552ef3189764c2a686ea34b2de7063ec7bfa726a9c8ec8d2c02f21d1c7f3/sanic-restful-api-0.0.6.tar.gz" } ] }