{ "info": { "author": "Chris Seto", "author_email": "chriskseto@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython" ], "description": "# Agent: Async generators for humans\n\n**agent** provides a simple decorator to create python 3.5 [asynchronous iterators](https://docs.python.org/3/reference/compound_stmts.html#async-for) via `yield`s\n\n## Examples\n\nMake people wait for things for no reason!\n```python\nimport agent\nimport asyncio\n\n@agent.gen # Shorthand decorator\ndef wait_for_me():\n yield 'Like '\n yield from asyncio.sleep(1)\n yield 'the line '\n yield from asyncio.sleep(10)\n yield 'at '\n yield from asyncio.sleep(100)\n yield 'the DMV'\n\nasync for part in wait_for_me():\n print(part)\n```\n\nPaginate websites in an easy asynchronous manner.\n```python\nimport agent\nimport aiohttp\n\n@agent.async_generator\ndef gen():\n page, url = 0, 'http://example.com/paginated/endpoint'\n while True:\n resp = yield from aiohttp.request('GET', url, params={'page': page})\n resp_json = (yield from resp.json())['data']\n if not resp_json:\n break\n for blob in resp_json['data']:\n yield blob\n page += 1\n\n# Later on....\n\nasync for blob in gen():\n # Do work\n```\n\n\n**The possibilities are endless!**\n\nFor additional, crazier, examples take a look in the [tests directory](tests/).\n\n\n## Get it\n\n```bash\n$ pip install -U agent\n```\n\n## Caveats\n\n`yield from` syntax must be used as `yield` in an `async def` block is a syntax error.\n\n```python\nasync def generator():\n yield 1 # Syntax Error :(\n```\n\n`asyncio.Future`s can not be yield directly, they must be wrapped by `agent.Result`.\n\n\n## License\n\nMIT licensed. See the bundled [LICENSE](LICENSE) file for more details.", "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/chrisseto/Agent", "keywords": null, "license": "The MIT License (MIT)\n\nCopyright (c) 2015 Chris Seto\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "agent", "package_url": "https://pypi.org/project/agent/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/agent/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/chrisseto/Agent" }, "release_url": "https://pypi.org/project/agent/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Async generators for humans", "version": "0.1.2" }, "last_serial": 1804002, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "40685cab2ce37ed769edf8ab6160fcd7", "sha256": "3a3a2d76e373b3deb321da949c3818b6ba1c18ff63aaa2be3104e081d0826ca4" }, "downloads": -1, "filename": "agent-0.1.0.tar.gz", "has_sig": false, "md5_digest": "40685cab2ce37ed769edf8ab6160fcd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3223, "upload_time": "2015-11-06T06:02:35", "url": "https://files.pythonhosted.org/packages/e7/88/1fa698598dd14ebfd792f32c1832af6a7fb729d0f893d590dce09426eae2/agent-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "4d5d088bf6972b0569aa55cca7850000", "sha256": "b07167bd5c8623ca1edc747814e12e5fce2538d5e676812223db80891dcb9ff3" }, "downloads": -1, "filename": "agent-0.1.1.tar.gz", "has_sig": false, "md5_digest": "4d5d088bf6972b0569aa55cca7850000", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3554, "upload_time": "2015-11-06T06:10:39", "url": "https://files.pythonhosted.org/packages/c4/3e/71eaf967da56ff8a5272322262d8b4a9c7d246aaa321b9717a6280c7e19d/agent-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "f09795340e357f7057550f7085d14edf", "sha256": "75e2654c40fd149c8f19f97da36d1f3818750571e6f1e734e1fb397d56a19e66" }, "downloads": -1, "filename": "agent-0.1.2.tar.gz", "has_sig": false, "md5_digest": "f09795340e357f7057550f7085d14edf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3549, "upload_time": "2015-11-06T06:11:20", "url": "https://files.pythonhosted.org/packages/85/69/3586641905a917f4929d584a79ac64f6df842f4e3ee51301643a73a8196e/agent-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f09795340e357f7057550f7085d14edf", "sha256": "75e2654c40fd149c8f19f97da36d1f3818750571e6f1e734e1fb397d56a19e66" }, "downloads": -1, "filename": "agent-0.1.2.tar.gz", "has_sig": false, "md5_digest": "f09795340e357f7057550f7085d14edf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3549, "upload_time": "2015-11-06T06:11:20", "url": "https://files.pythonhosted.org/packages/85/69/3586641905a917f4929d584a79ac64f6df842f4e3ee51301643a73a8196e/agent-0.1.2.tar.gz" } ] }