{ "info": { "author": "hsz", "author_email": "hsz1273327@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Documentation :: Sphinx" ], "description": "asyncio-executor\n===============================\n\n* version: 0.0.4\n\n* status: dev\n\n* author: hsz\n\n* email: hsz1273327@gmail.com\n\nDesc\n--------------------------------\n\nAsyncio executor for running coroutines. This code is from \n\n\nkeywords:asyncio,executor\n\n\nFeature\n----------------------\n* run coroutines asynchronously\n\nExample\n-------------------------------\n\n* run coroutines by using `submit`\n\n\n.. code:: python\n\n\n from concurrent.futures import as_completed\n import aiohttp\n from asyncio_executor import AsyncioExecutor\n\n async def httpget(url):\n async with aiohttp.ClientSession() as session:\n async with session.get(url) as resp:\n html = await resp.text(\"utf-8\")\n return len(html)\n\n with AsyncioExecutor() as executor:\n to_do = []\n urls = [\"https://github.com/\",\"https://docs.aiohttp.org/\"]\n for i in urls:\n job = executor.submit(httpget,i)\n to_do.append(job)\n\n for future in as_completed(to_do):\n res = future.result()\n\n\n\n* run coroutines by using map\n\n.. code:: python\n\n\n from concurrent.futures import as_completed\n import aiohttp\n from asyncio_executor import AsyncioExecutor\n\n async def httpget(url):\n async with aiohttp.ClientSession() as session:\n async with session.get(url) as resp:\n html = await resp.text(\"utf-8\")\n return len(html)\n\n with AsyncioExecutor() as executor:\n result = []\n urls = [\"https://github.com/\", \"https://docs.aiohttp.org/\"]\n for i in executor.map(httpget, urls):\n result.append(i)\n\n\n* run functions by using submit\n\n\n.. code:: python\n\n\n from concurrent.futures import as_completed\n import requests as rq\n from asyncio_executor import AsyncioExecutor\n\n def httpsync(url):\n req = rq.get(url)\n return len(req.text)\n\n with AsyncioExecutor() as executor:\n to_do = []\n urls = [\"https://github.com/\", \"https://docs.aiohttp.org/\"]\n for i in urls:\n job = executor.submit(httpsync, i)\n to_do.append(job)\n\n for future in as_completed(to_do):\n res = future.result()\n print(res)\n\n* run functions by using map\n\n.. code:: python\n\n\n from concurrent.futures import as_completed\n import requests as rq\n from asyncio_executor import AsyncioExecutor\n\n def httpsync(url):\n req = rq.get(url)\n return len(req.text)\n\n with AsyncioExecutor() as executor:\n\n result = []\n urls = [\"https://github.com/\", \"https://docs.aiohttp.org/\"]\n for i in executor.map(httpsync, urls):\n result.append(i)\n print(result)\n\n\n\nInstall\n--------------------------------\n\n- ``python -m pip install asyncio-executor``\n\n\n\nLimitations\n------------------------------\n\n* only support python 3.5+ ", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Python-Tools/asyncio-executor", "keywords": "asyncio", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "asyncio-executor", "package_url": "https://pypi.org/project/asyncio-executor/", "platform": "", "project_url": "https://pypi.org/project/asyncio-executor/", "project_urls": { "Homepage": "https://github.com/Python-Tools/asyncio-executor" }, "release_url": "https://pypi.org/project/asyncio-executor/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "asyncio-executor", "version": "0.0.4" }, "last_serial": 4113951, "releases": { "0.0.3": [ { "comment_text": "", "digests": { "md5": "4cf570bbcbb775089f637ef51786ae08", "sha256": "6c08b41cc060b0ff24ee7daac8baac97c2e74e6d3f08b83fcd1342e23004298e" }, "downloads": -1, "filename": "asyncio_executor-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "4cf570bbcbb775089f637ef51786ae08", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 6238, "upload_time": "2018-01-24T14:07:07", "url": "https://files.pythonhosted.org/packages/88/8c/683f0c1427705c986eba3717f218a8051c72cc32718ebf2abf252f99701e/asyncio_executor-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5b5aab9a33802f12ad6ae5db5798d2c", "sha256": "4026f22e22369be373227106d6eacb11d46fcc8982b530995dd67d88fcca3533" }, "downloads": -1, "filename": "asyncio-executor-0.0.3.tar.gz", "has_sig": false, "md5_digest": "e5b5aab9a33802f12ad6ae5db5798d2c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5002, "upload_time": "2018-01-24T14:07:03", "url": "https://files.pythonhosted.org/packages/7e/80/5b582e217bc5bb8d97736c4af671051f3510dd5c885876dec28e6e596f29/asyncio-executor-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "8faadcc5aecc073a7137ea2b023c884a", "sha256": "893db7b027172450256d3336833101a873269abc889aba819b761a0d4ab8cbb0" }, "downloads": -1, "filename": "asyncio_executor-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "8faadcc5aecc073a7137ea2b023c884a", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 6697, "upload_time": "2018-07-29T15:35:32", "url": "https://files.pythonhosted.org/packages/af/34/c8d2a3dea646fc6b4f764d4cb46f69a9992e3cd501ce26d4ce3137937ccb/asyncio_executor-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d40a1bbdcd9a600c8fcb581e376bbf42", "sha256": "b0aa050596f51d653a18bdc7a7347b4471607bd098948630eb27190fe2931b38" }, "downloads": -1, "filename": "asyncio-executor-0.0.4.tar.gz", "has_sig": false, "md5_digest": "d40a1bbdcd9a600c8fcb581e376bbf42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5403, "upload_time": "2018-07-29T15:35:28", "url": "https://files.pythonhosted.org/packages/82/2a/66a186e00d27e5d36a5c1f308619169f9659b1957d89f6a9f2146dfc68f3/asyncio-executor-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8faadcc5aecc073a7137ea2b023c884a", "sha256": "893db7b027172450256d3336833101a873269abc889aba819b761a0d4ab8cbb0" }, "downloads": -1, "filename": "asyncio_executor-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "8faadcc5aecc073a7137ea2b023c884a", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 6697, "upload_time": "2018-07-29T15:35:32", "url": "https://files.pythonhosted.org/packages/af/34/c8d2a3dea646fc6b4f764d4cb46f69a9992e3cd501ce26d4ce3137937ccb/asyncio_executor-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d40a1bbdcd9a600c8fcb581e376bbf42", "sha256": "b0aa050596f51d653a18bdc7a7347b4471607bd098948630eb27190fe2931b38" }, "downloads": -1, "filename": "asyncio-executor-0.0.4.tar.gz", "has_sig": false, "md5_digest": "d40a1bbdcd9a600c8fcb581e376bbf42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5403, "upload_time": "2018-07-29T15:35:28", "url": "https://files.pythonhosted.org/packages/82/2a/66a186e00d27e5d36a5c1f308619169f9659b1957d89f6a9f2146dfc68f3/asyncio-executor-0.0.4.tar.gz" } ] }