{ "info": { "author": "Jeff Knupp", "author_email": "jeff@jeffknupp.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Flask-Sandboy\n=============\n\n|Build Status| |Coverage Status| |Downloads| |Latest Version|\n\nFlask-Sandboy is `sandman's `__\nlitte brother. Like ``sandman``, Flask-Sandboy automatically generates\nREST APIs. Unlike ``sandman``, it does so from existing Flask-SQLAlchemy\nmodels.\n\n**tl;dr Flask-Sandboy gives your models a RESTful HTTP endpoint\nautomagically, with proper support for all HTTP methods. It takes two\nlines of code to use and has no dependencies.**\n\nInstallation\n------------\n\nFlask-Sandboy should be installed using ``pip``:\n\n.. code:: shell\n\n $ pip install flask-sandboy\n\nUsage\n-----\n\nHere is an example ``runserver.py`` for an existing Flask app with\nFlask-SQLAlchemy models:\n\n.. code:: python\n\n from flask import Flask\n from models import Machine, Cloud, db\n\n app = Flask(__name__)\n app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'\n db.init_app(app)\n with app.app_context():\n db.create_all()\n app.run(debug=True)\n\nAnd here is that same app with RESTful endpoints automatically created\nand managed by Flask-Sandboy\n\n.. code:: python\n\n from flask import Flask\n from flask.ext.sandboy import Sandboy\n\n from models import Machine, Cloud, db\n\n app = Flask(__name__)\n app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///db.sqlite3'\n db.init_app(app)\n with app.app_context():\n db.create_all()\n sandboy = Sandboy(app, db, [Cloud, Machine])\n app.run(debug=True)\n\nThe only thing you need to do is instantiate the ``Sandboy`` class with\nyour app, your Flask-SQLAlchemy object (typically named ``db``), and a\nlist of Model classes for which you want REST endpoints created.\n\nStart the server and let's test out our new REST API:\n\n.. code:: shell\n\n $ http -vv -j POST localhost:5000/cloud name=first_cloud description=\"my first cloud\" \u00a0\ue0b2\u00a0\ue0a0\u00a0master\n POST /cloud HTTP/1.1\n Accept: application/json\n Accept-Encoding: gzip, deflate, compress\n Content-Length: 56\n Content-Type: application/json; charset=utf-8\n Host: localhost:5000\n User-Agent: HTTPie/0.8.0\n\n {\n \"description\": \"my first cloud\",\n \"name\": \"first_cloud\"\n }\n\n HTTP/1.0 201 CREATED\n Content-Length: 75\n Content-Type: application/json\n Date: Tue, 06 May 2014 13:57:52 GMT\n Server: Werkzeug/0.9.4 Python/2.7.6\n\n {\n \"description\": \"my first cloud\",\n \"id\": 1,\n \"name\": \"first_cloud\"\n }\n\n.. code:: shell\n\n $ http localhost:5000/cloud/1 \u00a0\ue0b2\u00a0\ue0a0\u00a0master\n HTTP/1.0 200 OK\n Content-Length: 75\n Content-Type: application/json\n Date: Tue, 06 May 2014 13:53:18 GMT\n Server: Werkzeug/0.9.4 Python/2.7.6\n\n {\n \"description\": \"my first cloud\",\n \"id\": 1,\n \"name\": \"first_cloud\"\n }\n\n.. code:: shell\n\n $ http DELETE :5000/cloud/1 \u00a0\ue0b2\u00a0\ue0a0\u00a0master\n HTTP/1.0 204 NO CONTENT\n Content-Length: 0\n Content-Type: text/html; charset=utf-8\n Date: Tue, 06 May 2014 13:53:23 GMT\n Server: Werkzeug/0.9.4 Python/2.7.6\n\nAll common HTTP methods are implemented (``HEAD``, ``OPTIONS``, ``GET``,\n``DELETE``, ``POST``, ``PATCH``, ``PUT``) with proper HTTP status codes.\n\nValidating Requests\n-------------------\n\nFlask-Sandboy comes with built-in request validation, ensuring that all\nfields necessary to save the object to the database are present. Here's\nwhat happens when we forget to include a field:\n\n.. code:: shell\n\n $ http -j POST :5000/cloud name=\"bad cloud\" \u00a0\ue0b2\u00a0\ue0a0\u00a0develop\n HTTP/1.0 403 FORBIDDEN\n Content-Length: 45\n Content-Type: application/json\n Date: Tue, 06 May 2014 14:05:52 GMT\n Server: Werkzeug/0.9.4 Python/2.7.6\n\n {\n \"message\": \"cloud.description required\"\n }\n\nPagination\n----------\n\nFlask-Sandboy supports pagination of results by default. Simply add a\n``?page=2`` to your request to get paginated results. By\ndefault, 20 results per page are returned.\n\nTODO\n----\n\nI'll leave it up to the Issues tab to track this.\n\nRelease History\n---------------\n\n0.0.3\n~~~~~\n\n- various bug fixes\n- 100% test coverage\n- documentation\n\n0.0.2\n~~~~~\n\n- various bug fixes\n\n0.0.1\n~~~~~\n\n- Initial release\n\n.. |Build Status| image:: https://travis-ci.org/jeffknupp/flask_sandboy.svg?branch=develop\n :target: https://travis-ci.org/jeffknupp/flask_sandboy\n.. |Coverage Status| image:: https://coveralls.io/repos/jeffknupp/flask_sandboy/badge.png\n :target: https://coveralls.io/r/jeffknupp/flask_sandboy\n.. |Downloads| image:: https://pypip.in/download/flask_sandboy/badge.png\n :target: https://pypi.python.org/pypi/flask_sandboy/\n.. |Latest Version| image:: https://pypip.in/version/flask_sandboy/badge.png\n :target: https://pypi.python.org/pypi/flask_sandboy/", "description_content_type": null, "docs_url": "https://pythonhosted.org/flask_sandboy/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jeffknupp/flask_sandboy/", "keywords": null, "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "flask_sandboy", "package_url": "https://pypi.org/project/flask_sandboy/", "platform": "any", "project_url": "https://pypi.org/project/flask_sandboy/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/jeffknupp/flask_sandboy/" }, "release_url": "https://pypi.org/project/flask_sandboy/0.0.3/", "requires_dist": null, "requires_python": null, "summary": "Automated REST APIs for SQLAlchemy models", "version": "0.0.3" }, "last_serial": 1084643, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "297356d833425d15cd08d6adafe646e6", "sha256": "e1e691148b63d8daf06e82eb0120bd07eb298ddfd121bedc97432a0c8c85637d" }, "downloads": -1, "filename": "flask_sandboy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "297356d833425d15cd08d6adafe646e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4522, "upload_time": "2014-05-05T20:54:55", "url": "https://files.pythonhosted.org/packages/50/65/e6fb3709f875158b37af554a356bef48ab97535693b0093c2abdde4c17e6/flask_sandboy-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "731fd8935ba143865601a7aa8ba7d0b2", "sha256": "45f60b6017edf3f88c02e9a716ee12e4fa92821e3703b01bf680538c5d370751" }, "downloads": -1, "filename": "flask_sandboy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "731fd8935ba143865601a7aa8ba7d0b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6608, "upload_time": "2014-05-06T14:17:20", "url": "https://files.pythonhosted.org/packages/ce/23/595e729696d6e8c888cd10f4a029c5a93c82da0c03a8cddb61e56ec98eaa/flask_sandboy-0.0.2.tar.gz" } ], "0.0.2.1": [ { "comment_text": "", "digests": { "md5": "45f85d495c07ecc95fc5f799c720da8c", "sha256": "5e782e8cecfe0028f0a33c7807d677624fc1e62643e9a4dbfe29ce0f1f9e3e41" }, "downloads": -1, "filename": "flask_sandboy-0.0.2.1.tar.gz", "has_sig": false, "md5_digest": "45f85d495c07ecc95fc5f799c720da8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6613, "upload_time": "2014-05-06T14:18:49", "url": "https://files.pythonhosted.org/packages/26/78/558fe3b42a5c5c3dcbc51eece6a76452ce5d4bad7a5fbe4ade5ce395f88c/flask_sandboy-0.0.2.1.tar.gz" } ], "0.0.2.2": [ { "comment_text": "", "digests": { "md5": "eea89fdb1dfd582048fcfaa7172a4815", "sha256": "fd5954829dc56e0fcf6c1be6c6d9ba7829ac5f361e77a92a96be235d9d59b022" }, "downloads": -1, "filename": "flask_sandboy-0.0.2.2.tar.gz", "has_sig": false, "md5_digest": "eea89fdb1dfd582048fcfaa7172a4815", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6616, "upload_time": "2014-05-06T14:23:11", "url": "https://files.pythonhosted.org/packages/51/a3/b9503a055ea63b522198b3dfbfd75120743767738794ae8d328807a0e119/flask_sandboy-0.0.2.2.tar.gz" } ], "0.0.2.5": [ { "comment_text": "", "digests": { "md5": "53216334bee2aaa2022d4ebdd0bef979", "sha256": "594c5a5a030489a1422bd4f7dde5801ee2556f65ea2c65ecf404418111140923" }, "downloads": -1, "filename": "flask_sandboy-0.0.2.5.tar.gz", "has_sig": false, "md5_digest": "53216334bee2aaa2022d4ebdd0bef979", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6615, "upload_time": "2014-05-06T14:24:58", "url": "https://files.pythonhosted.org/packages/fe/a3/3fa36dc175c2d349ab0f9ffb0a502f25953f8187816e97a8e844558be3e0/flask_sandboy-0.0.2.5.tar.gz" } ], "0.0.2.6": [ { "comment_text": "", "digests": { "md5": "14a8d9a06afb4004833c393b3968c4e4", "sha256": "14a95ddfacff56172bc2faccef59925b040cd9b99d295dfd90f47c5ea4162406" }, "downloads": -1, "filename": "flask_sandboy-0.0.2.6.tar.gz", "has_sig": false, "md5_digest": "14a8d9a06afb4004833c393b3968c4e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6606, "upload_time": "2014-05-06T14:27:05", "url": "https://files.pythonhosted.org/packages/0b/ca/47d7867629e2323356a4233020d738be17e6f9645610d50f385590ae3fe8/flask_sandboy-0.0.2.6.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "842d0c2e359e7c8863685d115b918008", "sha256": "784071d8e227a3cdb98be844c0bc38869788e46e401f486816f1883ba110065c" }, "downloads": -1, "filename": "flask_sandboy-0.0.3.tar.gz", "has_sig": false, "md5_digest": "842d0c2e359e7c8863685d115b918008", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6889, "upload_time": "2014-05-07T21:15:25", "url": "https://files.pythonhosted.org/packages/c0/35/538f0981e8f7439cdad1d57cf9be5d2d1f11ba6e6cdb58a8d5ccedf6b901/flask_sandboy-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "842d0c2e359e7c8863685d115b918008", "sha256": "784071d8e227a3cdb98be844c0bc38869788e46e401f486816f1883ba110065c" }, "downloads": -1, "filename": "flask_sandboy-0.0.3.tar.gz", "has_sig": false, "md5_digest": "842d0c2e359e7c8863685d115b918008", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6889, "upload_time": "2014-05-07T21:15:25", "url": "https://files.pythonhosted.org/packages/c0/35/538f0981e8f7439cdad1d57cf9be5d2d1f11ba6e6cdb58a8d5ccedf6b901/flask_sandboy-0.0.3.tar.gz" } ] }