This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# Agent: Async generators for humans

**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

## Examples

Make people wait for things for no reason!
```python
import agent
import asyncio

@agent.gen # Shorthand decorator
def wait_for_me():
yield 'Like '
yield from asyncio.sleep(1)
yield 'the line '
yield from asyncio.sleep(10)
yield 'at '
yield from asyncio.sleep(100)
yield 'the DMV'

async for part in wait_for_me():
print(part)
```

Paginate websites in an easy asynchronous manner.
```python
import agent
import aiohttp

@agent.async_generator
def gen():
page, url = 0, 'http://example.com/paginated/endpoint'
while True:
resp = yield from aiohttp.request('GET', url, params={'page': page})
resp_json = (yield from resp.json())['data']
if not resp_json:
break
for blob in resp_json['data']:
yield blob
page += 1

# Later on....

async for blob in gen():
# Do work
```


**The possibilities are endless!**

For additional, crazier, examples take a look in the [tests directory](tests/).


## Get it

```bash
$ pip install -U agent
```

## Caveats

`yield from` syntax must be used as `yield` in an `async def` block is a syntax error.

```python
async def generator():
yield 1 # Syntax Error :(
```

`asyncio.Future`s can not be yield directly, they must be wrapped by `agent.Result`.


## License

MIT licensed. See the bundled [LICENSE](LICENSE) file for more details.
Release History

Release History

0.1.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
agent-0.1.2.tar.gz (3.5 kB) Copy SHA256 Checksum SHA256 Source Nov 6, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting