{ "info": { "author": "lanius", "author_email": "lanius@nirvake.org", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Flask-Mime\n==========\n\nFlask-Mime is Flask extension that enables applications to dispatch requests based on Accept header of it.\n\n\nInstall\n-------\n\nInstall the extension with the following command:\n\n.. code-block:: bash\n\n $ pip install Flask-Mime\n\n\nUsage\n-----\n\nCreate a Mime object and define routes with MIME types:\n\n.. code-block:: python\n\n from flask import Flask, render_template, jsonify\n from flask_mime import Mime\n\n app = Flask(__name__)\n mimetype = Mime(app)\n\n @mimetype('text/html')\n @app.route('/')\n def index_html():\n return render_template('index.html')\n\n @mimetype('application/json')\n @app.route('/')\n def index_json():\n return jsonify(data={'content': 'index'})\n\n\nEach requests are dispatched depending on the value of Accept header, even though they have same request path:\n\n.. code-block:: python\n\n client = app.test_client()\n client.get('/', headers={'Accept': 'text/html'}) # returns html\n client.get('/', headers={'Accept': 'application/json'}) # returns json\n\n\nNote\n----\n\nNote that MIME type based request dispatching mechanism may have negative influence for some applications, for example, which has a cache system.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lanius/flask-mime/", "keywords": null, "license": "Copyright (c) 2014 by lanius.\n\nSome rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n* Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n* The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "maintainer": null, "maintainer_email": null, "name": "Flask-Mime", "package_url": "https://pypi.org/project/Flask-Mime/", "platform": "any", "project_url": "https://pypi.org/project/Flask-Mime/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/lanius/flask-mime/" }, "release_url": "https://pypi.org/project/Flask-Mime/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Provides MIME type based request dispatching mechanism.", "version": "0.1.0" }, "last_serial": 1004754, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "da68e86ca1df2be711b45d28b63f5a0f", "sha256": "05991d7dfc62860493ed67f84aab2f0eb269a5318ab1b610b4036fc5ac96f6aa" }, "downloads": -1, "filename": "Flask-Mime-0.1.0.tar.gz", "has_sig": false, "md5_digest": "da68e86ca1df2be711b45d28b63f5a0f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5421, "upload_time": "2014-02-19T11:31:16", "url": "https://files.pythonhosted.org/packages/9d/43/70a55f1077992b5ed649fed16c1a7295f1234de54f45bc1d245c6f9b83b9/Flask-Mime-0.1.0.tar.gz" }, { "comment_text": "", "digests": { "md5": "3c113c4c56397b231452027650e9cfd3", "sha256": "60e816578bdd75ecd099ad732ec8ef1e0f4774df335e5126db0f9eee8be1388c" }, "downloads": -1, "filename": "Flask-Mime-0.1.0.zip", "has_sig": false, "md5_digest": "3c113c4c56397b231452027650e9cfd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10263, "upload_time": "2014-02-19T11:31:20", "url": "https://files.pythonhosted.org/packages/14/bf/f8b88bcf368b29517999093f796bacc26f5770647ec644667d923ef4aced/Flask-Mime-0.1.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "da68e86ca1df2be711b45d28b63f5a0f", "sha256": "05991d7dfc62860493ed67f84aab2f0eb269a5318ab1b610b4036fc5ac96f6aa" }, "downloads": -1, "filename": "Flask-Mime-0.1.0.tar.gz", "has_sig": false, "md5_digest": "da68e86ca1df2be711b45d28b63f5a0f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5421, "upload_time": "2014-02-19T11:31:16", "url": "https://files.pythonhosted.org/packages/9d/43/70a55f1077992b5ed649fed16c1a7295f1234de54f45bc1d245c6f9b83b9/Flask-Mime-0.1.0.tar.gz" }, { "comment_text": "", "digests": { "md5": "3c113c4c56397b231452027650e9cfd3", "sha256": "60e816578bdd75ecd099ad732ec8ef1e0f4774df335e5126db0f9eee8be1388c" }, "downloads": -1, "filename": "Flask-Mime-0.1.0.zip", "has_sig": false, "md5_digest": "3c113c4c56397b231452027650e9cfd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10263, "upload_time": "2014-02-19T11:31:20", "url": "https://files.pythonhosted.org/packages/14/bf/f8b88bcf368b29517999093f796bacc26f5770647ec644667d923ef4aced/Flask-Mime-0.1.0.zip" } ] }