{ "info": { "author": "Victor Klapholz", "author_email": "victor.klapholz@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "*****************************************************************************************\n:fire:flask-json-api:fire:: Flask boilerplate setup code for REST application/json API's\n*****************************************************************************************\n\nThe **Flask JSON API** package provides boilerplate code for setting up REST based apps\nwritten with `Flask `_.\n\n\n\nInstalling flask-json-api\n=========================\n\n.. code-block:: bash\n\n pip install flask-json-api\n\n\nUsing Flask JSON API\n====================\n\nUsing **Flak JSON API** is as easy as initiating it with the Flask app instance:\n\n.. code-block:: python\n\n from flask import Flask\n\n from flask_json_api import FlaskJsonApi\n\n app = Flask(__name__)\n\n flask_json_api = FlaskJsonApi(app)\n\nHow it works\n============\n\nThis package requires the ``application/json content-type`` header, or else an HTTP error will be returned:\n\n.. code-block:: python\n\n import requests\n\n # providing the application/json content type will succeed\n url = 'http://localhost:5000/api'\n headers = {'Content-Type': 'application/json'}\n\n r = requests.get(url, headers=headers)\n\n assert r.status_code == 200\n\n # not providing the application/json content type will fail\n url = 'http://localhost:5000/api'\n\n r = requests.get(url)\n\n assert r.status_code == 415\n\n\nRegister expected and unexpected exception types:\n=================================================\nAlthough all errors should be returned as JSON, you can register different exception types as:\n * ``Expected Errors`` - will return **400** http error code (and logged with WARNING level)\n * ``Unexpected Errors`` - will return **500** http error code (and logged with ERROR level)\n\n.. code-block:: python\n\n class ExpectedError(Exception):\n \"\"\"Expected error, such as Data Validation Error\"\"\"\n\n class UnexpectedError(Exception):\n \"\"\"Unexpected error, such as database is not accessible\"\"\"\n\n flask_json_api.register_expected_exception(ExpectedError)\n flask_json_api.register_unexpected_exception(UnexpectedError)\n\nWhitelisting paths that do not require application/json\n-------------------------------------------------------\nWhenever the ``flask.request.path`` starts with any of these ``exclude_paths``, then the\napplication/json header won't be required.\n\n.. code-block:: python\n\n flask_json_api.set_application_json_exclude_paths(exclude_paths=['/home'])\n\n # Please note that if the exclude_paths will contain '/',\n # then no path will require the application/json content-type", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/py-ddd/flask-json-api", "keywords": "flask", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "flask-json-api", "package_url": "https://pypi.org/project/flask-json-api/", "platform": "", "project_url": "https://pypi.org/project/flask-json-api/", "project_urls": { "Homepage": "https://gitlab.com/py-ddd/flask-json-api" }, "release_url": "https://pypi.org/project/flask-json-api/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "The Flask JSON API package provides boilerplate code for setting up REST based apps.", "version": "1.0.0" }, "last_serial": 3701994, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "ba549df81c393363129f284010e3773d", "sha256": "4fc21069bc85ba1968c9fd36d2c8d4b1e0657568ed94735d07ef628e5d4fac2b" }, "downloads": -1, "filename": "flask-json-api-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ba549df81c393363129f284010e3773d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3460, "upload_time": "2018-03-24T18:27:09", "url": "https://files.pythonhosted.org/packages/f9/87/d486b9b1381a896b77e196e097e37dfe6611c9ba5d805b6a6277adec6e3d/flask-json-api-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ba549df81c393363129f284010e3773d", "sha256": "4fc21069bc85ba1968c9fd36d2c8d4b1e0657568ed94735d07ef628e5d4fac2b" }, "downloads": -1, "filename": "flask-json-api-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ba549df81c393363129f284010e3773d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3460, "upload_time": "2018-03-24T18:27:09", "url": "https://files.pythonhosted.org/packages/f9/87/d486b9b1381a896b77e196e097e37dfe6611c9ba5d805b6a6277adec6e3d/flask-json-api-1.0.0.tar.gz" } ] }