{ "info": { "author": "cs91chris", "author_email": "cs91chris@voidbrain.me", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Flask-ErrorsHandler\n===================\n\nSet customizable default errors handler for flask app and blueprints.\n\nYou can register error handler for:\n\n- api that returns JSON, default response is as API problem specification like (see https://tools.ietf.org/html/rfc7807).\n Instead you can use your own response implementation passed as argument to ``ErrorHandler`` class:\n it must be a decorator and must take 3 args, a dict response, status code and dict headers.\n- web that returns html page or api response if request is XHR\n- you can register custom handlers for blueprint or the entire app\n\nThis module provide also an abstract ``ErrorDispatcher`` class in order to dispatch 404 or 405 error to the correct blueprint\nbecause flask Blueprint does not own url_prefix (see https://github.com/pallets/flask/issues/1498).\n\nThere are 2 concrete implementation:\n\n- ``SubdomainDispatcher``: dispatch the error to the handler associate with blueprint with certain subdomain\n (if 2 or more Blueprint has the same subdomain the first blueprint handler matched is used)\n- ``URLPrefixDispatcher``: dispatch the error to the handler associate with blueprint with certain url prefix.\n This will not work if 2 Blueprint are registered under the same url prefix, for example:\n Blueprint A registered under /prefix/blueprint, Blueprint B registered under /prefix, this dispatcher executes the handler\n of B in both case if B is registered after A.\n\nMoreover you can create you own dispatcher by extending ``ErrorDispatcher`` class and implementing ``dispatch`` method.\nOnly the *last* ErrorDispatcher registered is execute. This is the best solution I have found, suggestions are welcome.\n\n\nQuickStart\n~~~~~~~~~~\n\nInstall ``flask_errors_handler`` using ``pip``:\n\n::\n\n $ pip install Flask-ErrorsHandler\n\n.. _section-1:\n\nExample usage\n^^^^^^^^^^^^^\n\n.. code:: python\n\n from flask import Flask\n from flask import abort\n from flask import Blueprint\n\n from flask_errors_handler import ErrorHandler\n\n\n app = Flask(__name__)\n app.config['ERROR_PAGE'] = 'error.html'\n\n error = ErrorHandler(app)\n\n custom = Blueprint('custom', __name__)\n web = Blueprint('web', __name__)\n\n error.api_register(app)\n error.web_register(web)\n\n @error.register(custom)\n def error_handler(exc):\n return str(exc), 500, {'Content-Type': 'text/plain'}\n\n\n @app.route('/api')\n def index():\n abort(500, 'Error from app')\n\n\n @web.route('/web')\n def index():\n abort(500, 'Error from web blueprint')\n\n\n @custom.route('/custom')\n def index():\n abort(500, 'Error from custom blueprint')\n\n\n app.register_blueprint(web)\n app.run()\n\n\n- Go to http://127.0.0.1:5000/api and see error message response as a JSON\n- Go to http://127.0.0.1:5000/web and see error message response as an HTML page\n- Go to http://127.0.0.1:5000/custom and see error message response as a plain text\n\n.. _section-2:\n\nConfiguration\n^^^^^^^^^^^^^\n\n1. ``ERROR_PAGE``: *(default: None)* path of html template to use for show error message\n2. ``ERROR_DEFAULT_MSG``: *(default: Unhandled Exception)* default message for unhandled exceptions\n3. ``ERROR_XHR_ENABLED``: *(default: True)* enable or disable api response where request is XHR\n\n\nLicense MIT\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cs91chris/flask_errors_handler", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Flask-ErrorsHandler", "package_url": "https://pypi.org/project/Flask-ErrorsHandler/", "platform": "any", "project_url": "https://pypi.org/project/Flask-ErrorsHandler/", "project_urls": { "Homepage": "https://github.com/cs91chris/flask_errors_handler" }, "release_url": "https://pypi.org/project/Flask-ErrorsHandler/2.2.0/", "requires_dist": [ "Flask (==1.0.*)" ], "requires_python": "", "summary": "Customizable errors handler for flask application and blueprints", "version": "2.2.0" }, "last_serial": 5378767, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "6a5ff44e85eceaad9132a2920a14d319", "sha256": "a9f519e6ea43ffb3ad6a7ccf957e90a738b3efd4f3869435da218e82133a7deb" }, "downloads": -1, "filename": "Flask_ErrorsHandler-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6a5ff44e85eceaad9132a2920a14d319", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4028, "upload_time": "2019-01-10T14:15:44", "url": "https://files.pythonhosted.org/packages/b5/2d/c9c99ec8dfdedbcee5f26039afa43b7cf04b7dda00408b712f32e45238f4/Flask_ErrorsHandler-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "598899b21492babddca90933a27d521b", "sha256": "3c341d695c5b0ba846ec6d8238cfa3ad7f1bf6ac8967bcdf4729f10fe247f099" }, "downloads": -1, "filename": "Flask-ErrorsHandler-0.0.1.tar.gz", "has_sig": false, "md5_digest": "598899b21492babddca90933a27d521b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2806, "upload_time": "2019-01-10T14:15:47", "url": "https://files.pythonhosted.org/packages/8c/d5/026e47ad75d035a0491c3fb8b16f132008d839c7da5689986baf08c8fb9d/Flask-ErrorsHandler-0.0.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "7e31d2c8f91803be85093aff99f881a6", "sha256": "96e5957bf078fff1df0ace74f35c84afd350b0a2808e35bfd5a4628d27f0d3d8" }, "downloads": -1, "filename": "Flask_ErrorsHandler-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7e31d2c8f91803be85093aff99f881a6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4027, "upload_time": "2019-04-02T13:39:02", "url": "https://files.pythonhosted.org/packages/25/7e/a4b8043bfa2199b9fe87b6deef651e4413152c764bb33dcca2355d5be402/Flask_ErrorsHandler-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e75aedc8718bf16f6b329a3adac1c4d4", "sha256": "3eff9c30243057536aa86bb194d6a5288f80e06d5d4cd71767e2511554c20771" }, "downloads": -1, "filename": "Flask-ErrorsHandler-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e75aedc8718bf16f6b329a3adac1c4d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2814, "upload_time": "2019-04-02T13:39:04", "url": "https://files.pythonhosted.org/packages/41/23/99fa966b12377b77469a6184bd7deb8ed31f7b1b5fe7efd809019d4d237a/Flask-ErrorsHandler-1.0.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "add14812c619ee00b0a2e4e4927ea0f0", "sha256": "5a5fabe56768b41bc223c5bbbe31f99201075c2b3ff927a478833ffb3ef4a8cd" }, "downloads": -1, "filename": "Flask_ErrorsHandler-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "add14812c619ee00b0a2e4e4927ea0f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5670, "upload_time": "2019-05-25T22:31:48", "url": "https://files.pythonhosted.org/packages/4e/3c/d6737e118da954375a16c70c67f9a0530f80ad2acc5793be66c7db835510/Flask_ErrorsHandler-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fac71f3128cdd62a560576943a9378ba", "sha256": "837e3eeb5cc70faa9ae8797e2e2ccd12d326bc2e62f3dd24d004c638a0747e4f" }, "downloads": -1, "filename": "Flask-ErrorsHandler-2.0.0.tar.gz", "has_sig": false, "md5_digest": "fac71f3128cdd62a560576943a9378ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4033, "upload_time": "2019-05-25T22:31:49", "url": "https://files.pythonhosted.org/packages/69/ee/f5164aa4ac3fc66c1d22ada01c07c66f460e094f2d31de6f4d8652487abf/Flask-ErrorsHandler-2.0.0.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "43265a8afeabfb83eb35c8970567a3db", "sha256": "2b36976b28c0b93f0d716b26e2cbac024396f50e5613f0d052a76d7b6bf92057" }, "downloads": -1, "filename": "Flask_ErrorsHandler-2.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "43265a8afeabfb83eb35c8970567a3db", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7858, "upload_time": "2019-05-30T21:34:40", "url": "https://files.pythonhosted.org/packages/a4/2a/d6cab25ec549b461529b9394ac20ecf3f3d9db92e4a153735c00163cf558/Flask_ErrorsHandler-2.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bdd4b80ae4f45a474ca012ae1928646d", "sha256": "9484e3e7a54c49da0ab7721d28cbee5a844dcd7c049f936c8cdea032b059026d" }, "downloads": -1, "filename": "Flask-ErrorsHandler-2.1.0.tar.gz", "has_sig": false, "md5_digest": "bdd4b80ae4f45a474ca012ae1928646d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5874, "upload_time": "2019-05-30T21:34:42", "url": "https://files.pythonhosted.org/packages/5b/d2/2f446e35b604fce766a8abc221527ebaf5f496beb98c51566ff6a9b0791a/Flask-ErrorsHandler-2.1.0.tar.gz" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "d78da915c3990f49543c30d4820ae21f", "sha256": "ce7138d1cc9138419574b5a9fc7995f5551ba23ccaba93bb6b1a9e5e8a584233" }, "downloads": -1, "filename": "Flask_ErrorsHandler-2.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "d78da915c3990f49543c30d4820ae21f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9482, "upload_time": "2019-06-04T23:08:06", "url": "https://files.pythonhosted.org/packages/f3/be/f69834755b663fd87bda0b2eadd69391372456051742d2c11fddff2fa4cf/Flask_ErrorsHandler-2.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dd7f61561a28c441ad99587eb6ef6e76", "sha256": "9c534438e05842ba1507a560e805b4e95925e50a397ff6014ff80272cb6d7811" }, "downloads": -1, "filename": "Flask-ErrorsHandler-2.1.1.tar.gz", "has_sig": false, "md5_digest": "dd7f61561a28c441ad99587eb6ef6e76", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7186, "upload_time": "2019-06-04T23:08:07", "url": "https://files.pythonhosted.org/packages/09/32/1495afad7b4c90160b884518fb4f2a0ca385e3f1d0adb3e2746adc96d010/Flask-ErrorsHandler-2.1.1.tar.gz" } ], "2.2.0": [ { "comment_text": "", "digests": { "md5": "57bae8e27ca932c5ae85c24ab5800b7d", "sha256": "bc2b5a2eabffa9deb4d6deca81d0ea13199837bcba749268fd02e36eb6891f3c" }, "downloads": -1, "filename": "Flask_ErrorsHandler-2.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "57bae8e27ca932c5ae85c24ab5800b7d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12043, "upload_time": "2019-06-09T21:21:05", "url": "https://files.pythonhosted.org/packages/2a/cb/6e75fe40ad2c154a96466a8cba9dde63617a3ffd10369b60af52c8e15199/Flask_ErrorsHandler-2.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5c1f51b0e57d27b77b9d461d47f74d3", "sha256": "3616b3a5c05c51fee939100ac374738d4db81e701afd06e36c03e43354abb032" }, "downloads": -1, "filename": "Flask-ErrorsHandler-2.2.0.tar.gz", "has_sig": false, "md5_digest": "e5c1f51b0e57d27b77b9d461d47f74d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7616, "upload_time": "2019-06-09T21:21:07", "url": "https://files.pythonhosted.org/packages/57/36/da2eb99a4790327c96636b89cebf9b3c58d644de343270a80f0d43a4f4d3/Flask-ErrorsHandler-2.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "57bae8e27ca932c5ae85c24ab5800b7d", "sha256": "bc2b5a2eabffa9deb4d6deca81d0ea13199837bcba749268fd02e36eb6891f3c" }, "downloads": -1, "filename": "Flask_ErrorsHandler-2.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "57bae8e27ca932c5ae85c24ab5800b7d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12043, "upload_time": "2019-06-09T21:21:05", "url": "https://files.pythonhosted.org/packages/2a/cb/6e75fe40ad2c154a96466a8cba9dde63617a3ffd10369b60af52c8e15199/Flask_ErrorsHandler-2.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5c1f51b0e57d27b77b9d461d47f74d3", "sha256": "3616b3a5c05c51fee939100ac374738d4db81e701afd06e36c03e43354abb032" }, "downloads": -1, "filename": "Flask-ErrorsHandler-2.2.0.tar.gz", "has_sig": false, "md5_digest": "e5c1f51b0e57d27b77b9d461d47f74d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7616, "upload_time": "2019-06-09T21:21:07", "url": "https://files.pythonhosted.org/packages/57/36/da2eb99a4790327c96636b89cebf9b3c58d644de343270a80f0d43a4f4d3/Flask-ErrorsHandler-2.2.0.tar.gz" } ] }