{ "info": { "author": "iamsk", "author_email": "iamsk.info@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "TMiddleware\n===========\n\nMiddleware for tornado\n\n[![Build Status](https://travis-ci.org/iamsk/tmiddleware.png)](https://travis-ci.org/iamsk/tmiddleware)\n\n## Installation\n\n\tpip install tmiddleware\n\t\n\tor\n \n git clone git@github.com:iamsk/tmiddleware.git\n cd tmiddleware\n python setup.py install\n\n## Requirements\n\n* python 2.6 or 2.7\n* tornado 2.4+\n\n## Minimal Demo\n\n### $ more examples/miminal.py\n\n import tornado\n import tornado.httpserver\n from tornado.options import define, options\n from tornado.web import RequestHandler\n \n from tmiddleware.handler import TMiddlewareHandler\n \n define('port', 7777)\n MIDDLEWARES = ['plugins.slow_request.SlowRequestMiddleware', 'plugins.profile.ProfileMiddleware']\n define(\"middlewares\", default=MIDDLEWARES, help=\"middleware class list\")\n \n \n class With(TMiddlewareHandler):\n def get(self):\n import time\n time.sleep(4)\n return self.finish('Hello World!')\n \n \n def run():\n application = tornado.web.Application([('/', With)])\n http_server = tornado.httpserver.HTTPServer(application, xheaders=True)\n http_server.listen(options.port, '0.0.0.0')\n tornado.ioloop.IOLoop.instance().start()\n \n if __name__ == '__main__':\n run()\n\n\u6b64\u5904\u4f7f\u7528\u4e86\u81ea\u5e26\u7684\u4e24\u4e2a middleware\uff0c\u4e00\u4e2a\u7528\u4e8e\u67e5\u770b\u8bf7\u6c42\u7684 profile \u4fe1\u606f\uff0c\u4e00\u4e2a\u7528\u4e8e\u5728\u7ec8\u7aef\u4e0b\u8bb0\u5f55\u8d85\u65f6\u7684\u8bf7\u6c42\n\n### $ python miminal.py\n\n### $ chrome http://localhost:7777/?__profile__=true\n\nweb:\n\n![TMiddleware-web](tmiddleware-web.jpg)\n\nconsole:\n\n![TMiddleware-console](tmiddleware-console.jpg)\n\n##Plugins\n\n\u81ea\u5e26\u4e86\u4e24\u4e2a\uff1a\n\n1. profile: \u67e5\u770b\u8bf7\u6c42\u7684\u5185\u90e8\u51fd\u6570\u8017\u65f6\u4fe1\u606f\n2. slow_request: \u8bb0\u5f55\u8d85\u65f6\u8bf7\u6c42\n\n\u81ea\u5b9a\u4e49\u63d2\u4ef6\u53c2\u8003\u8fd9\u4e24\u4e2a\u5373\u53ef", "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/iamsk/tmiddleware", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "TMiddleware", "package_url": "https://pypi.org/project/TMiddleware/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/TMiddleware/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/iamsk/tmiddleware" }, "release_url": "https://pypi.org/project/TMiddleware/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "tornado middleware", "version": "0.0.1" }, "last_serial": 932339, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "67c61ee3ec5d6aa5ed755a133c31d444", "sha256": "6c9bc06bde21505bba3941804d0e981f382cb552f2e8d284cbbd5ec49e594e0a" }, "downloads": -1, "filename": "TMiddleware-0.0.1.tar.gz", "has_sig": false, "md5_digest": "67c61ee3ec5d6aa5ed755a133c31d444", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 117148, "upload_time": "2013-11-30T06:50:27", "url": "https://files.pythonhosted.org/packages/f5/dd/d327637e35d91389dc8b0aff07d8fc486ba54a9f0c12427ef02675f71302/TMiddleware-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "67c61ee3ec5d6aa5ed755a133c31d444", "sha256": "6c9bc06bde21505bba3941804d0e981f382cb552f2e8d284cbbd5ec49e594e0a" }, "downloads": -1, "filename": "TMiddleware-0.0.1.tar.gz", "has_sig": false, "md5_digest": "67c61ee3ec5d6aa5ed755a133c31d444", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 117148, "upload_time": "2013-11-30T06:50:27", "url": "https://files.pythonhosted.org/packages/f5/dd/d327637e35d91389dc8b0aff07d8fc486ba54a9f0c12427ef02675f71302/TMiddleware-0.0.1.tar.gz" } ] }