{ "info": { "author": "Robin Peters", "author_email": "github@rpeters.dk", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "# Flask Server-Timing Header Extension\n\nA Flask extension to easily add the Server-Timing header to allow supported browsers to show backend performance metrics.\n\nFrom the [Mozilla Developer site](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing):\n\n> The Server-Timing header communicates one or more metrics and descriptions for a given request-response cycle. It is used to surface any backend server timing metrics (e.g. database read/write, CPU time, file system access, etc.) in the developer tools in the user's browser\n\n\nThe Server-Timing specification is a [W3C draft](https://www.w3.org/TR/server-timing)\n\n## Installation\n\n```\npip install flask-server-timing\n```\n\nPython versions 2.7 and 3.x are supported with Flask from version 0.10.1.\n\n## Browser Support\n\nGenerally all newer, major browsers - excluding IE and Safari - support visualizing the Server-Timing header. For an up-to-date list with specific versions see the [Mozilla Developer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing#Browser_compatibility) site\n\n## Usage\n\n```python\nfrom flask import Flask\nimport time\n\n# Import extension\nfrom from server_timing import Timing\n\napp = Flask(__name__)\n\n# To initialize the extension simply pass the app to it. If the app is in debug\n# mode or the force_debug parameter is True an after-request handler will be added\n# to write the actual header.\nt = Timing(app, force_debug=True)\n\n\n@app.route(\"/examples\")\ndef examples():\n # explicitly calling start and stop before and after - keys need to be identical\n t.start('done and done')\n time.sleep(0.3)\n t.stop('done and done')\n\n # context manager support to avoid having to call start and stop explicitly\n with t.time('context'):\n time.sleep(0.2)\n\n # decorated with name being the key\n named_decoration()\n # decorated without name so the function is the key\n unnamed_decoration()\n\n@t.timer(name='named')\ndef named_decoration():\n time.sleep(0.4)\n\n@t.timer\ndef unnamed_decoration():\n time.sleep(0.5)\n\n\napp.run(host=\"0.0.0.0\",port=8080)\n```\n\nThe `example/` directory also contains the following file showing how to time functions in other modules:\n\n```python\nimport time\n\n# before this file is imported make sure the extension has been initialized with the Flask app\nfrom server_timing import Timing as t\n\n\n@t.timer\ndef include():\n time.sleep(0.1)\n```", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rodrobin/flask-server-timing", "keywords": "Python Flask Server-Timing Header Extension", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "flask-server-timing", "package_url": "https://pypi.org/project/flask-server-timing/", "platform": "Linux", "project_url": "https://pypi.org/project/flask-server-timing/", "project_urls": { "Homepage": "https://github.com/rodrobin/flask-server-timing" }, "release_url": "https://pypi.org/project/flask-server-timing/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "Python Flask Server-Timing Header Extension", "version": "0.1.2" }, "last_serial": 4432431, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "8893cabb842d4793e8d8f7a285bbc9b6", "sha256": "71fbaff54803cbecb758e69a2b1b95cb84a118bd1e3208de410ecaa9f25d592f" }, "downloads": -1, "filename": "flask-server-timing-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8893cabb842d4793e8d8f7a285bbc9b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3337, "upload_time": "2018-10-27T12:38:13", "url": "https://files.pythonhosted.org/packages/d9/d6/735fdb3e4fa48b37860297df0b7b39337f91845887ff85a973ac28cc1ea4/flask-server-timing-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "34b0e9f07378d3fe58849f3b5e159a54", "sha256": "e448683912089ada8d3af78c260687e1b5bfd0381430f8b52f7ff2a931166efa" }, "downloads": -1, "filename": "flask-server-timing-0.1.2.tar.gz", "has_sig": false, "md5_digest": "34b0e9f07378d3fe58849f3b5e159a54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3292, "upload_time": "2018-10-30T17:35:37", "url": "https://files.pythonhosted.org/packages/6c/21/f14bcfdc7a9554949d2a87a73ce5c1b7802cf359f5fca5ef33f07669eaf8/flask-server-timing-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "34b0e9f07378d3fe58849f3b5e159a54", "sha256": "e448683912089ada8d3af78c260687e1b5bfd0381430f8b52f7ff2a931166efa" }, "downloads": -1, "filename": "flask-server-timing-0.1.2.tar.gz", "has_sig": false, "md5_digest": "34b0e9f07378d3fe58849f3b5e159a54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3292, "upload_time": "2018-10-30T17:35:37", "url": "https://files.pythonhosted.org/packages/6c/21/f14bcfdc7a9554949d2a87a73ce5c1b7802cf359f5fca5ef33f07669eaf8/flask-server-timing-0.1.2.tar.gz" } ] }