{ "info": { "author": "Zhen Wang", "author_email": "mail@zhenwang.info", "bugtrack_url": null, "classifiers": [], "description": "asyncwsgi\r\n==========\r\n``asyncwsgi`` is a simple package for tornado and asyncio(WIP) to enable the\r\nuse of the WSGI interface asynchronously. Behind the scenes ``greenlet`` is\r\nused to pause and resume each request.\r\n\r\n\r\nUsage\r\n------\r\n#. Decorate functions that require async with ``asyncwsgi.coroutine``\r\n#. Use ``asyncwsgi.wrap`` to wrap the WSGI container.\r\n#. Run the event loop using ``asyncwsgi.run``\r\n\r\n\r\n\r\nExamples\r\n---------\r\n\r\nDjango ::\r\n\r\n @asyncwsgi.coroutine\r\n def my_view(request):\r\n http_client = AsyncHTTPClient()\r\n response = yield http_client.fetch('http://www.google.com/')\r\n return render(request, 'my_view.html', {'code': response.code})\r\n\r\n ...\r\n # Patch django to run on tornado's event loop\r\n def run(host, port, app, **options):\r\n container = asyncwsgi.wrap(WSGIContainer(app))\r\n http_server = HTTPServer(container)\r\n http_server.listen(port, host)\r\n asyncwsgi.run(IOLoop.current())\r\n\r\n if __name__ == \"__main__\":\r\n ...\r\n from django.core.management.commands import runserver\r\n runserver.run = run\r\n\r\nBottle ::\r\n\r\n import asyncwsgi\r\n import bottle\r\n from tornado.httpclient import AsyncHTTPClient\r\n from tornado.wsgi import WSGIContainer\r\n from tornado.httpserver import HTTPServer\r\n from tornado.ioloop import IOLoop\r\n\r\n @bottle.get('/')\r\n @asyncwsgi.coroutine\r\n def index():\r\n http_client = AsyncHTTPClient()\r\n response = yield http_client.fetch('http://www.google.com/')\r\n return 'Status: %d' % response.code\r\n\r\n container = asyncwsgi.wrap(WSGIContainer(bottle.default_app()))\r\n http_server = HTTPServer(container)\r\n http_server.listen(8080)\r\n asyncwsgi.run(IOLoop.current())\r\n\r\n\r\nInstallation\r\n-------------\r\n``pip install asyncwsgi``\r\n\r\n\r\nTodo\r\n-----\r\n* asyncio not fully supported\r\n\r\n\r\nLicense\r\n--------\r\nMIT licensed. See LICENSE for details.", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/nehz/asyncwsgi/tarball/0.1.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nehz/asyncwsgi", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "asyncwsgi", "package_url": "https://pypi.org/project/asyncwsgi/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/asyncwsgi/", "project_urls": { "Download": "https://github.com/nehz/asyncwsgi/tarball/0.1.0", "Homepage": "https://github.com/nehz/asyncwsgi" }, "release_url": "https://pypi.org/project/asyncwsgi/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Async WSGI support for tornado and asyncio", "version": "0.1.0" }, "last_serial": 1521523, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6fe89bbb2877ef71072cf7d9819e8447", "sha256": "ec3fd446e3c18afc4eb36f9fa51eb7c99b62abaa5ad2d9ee342f13836f6d5584" }, "downloads": -1, "filename": "asyncwsgi-0.1.zip", "has_sig": false, "md5_digest": "6fe89bbb2877ef71072cf7d9819e8447", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5318, "upload_time": "2015-04-26T09:41:30", "url": "https://files.pythonhosted.org/packages/76/79/b13eff66df4ed99b5561a9a976f2204c3d24d6e7c3bc216e476a334e1f8b/asyncwsgi-0.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6fe89bbb2877ef71072cf7d9819e8447", "sha256": "ec3fd446e3c18afc4eb36f9fa51eb7c99b62abaa5ad2d9ee342f13836f6d5584" }, "downloads": -1, "filename": "asyncwsgi-0.1.zip", "has_sig": false, "md5_digest": "6fe89bbb2877ef71072cf7d9819e8447", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5318, "upload_time": "2015-04-26T09:41:30", "url": "https://files.pythonhosted.org/packages/76/79/b13eff66df4ed99b5561a9a976f2204c3d24d6e7c3bc216e476a334e1f8b/asyncwsgi-0.1.zip" } ] }