Skip to content

Conversation

acrogenesis
Copy link

Fix #8

@juliusbierk
Copy link

Probably even more correct to do

from requests_threads import AsyncSession

session = AsyncSession(n=100)

async def _main():
    rs = []
    for _ in range(100):
        rs.append(asyncio.ensure_future(session.get('http://httpbin.org/get')))
    for i in range(100):
        rs[i] = await rs[i]
    print(rs)

if __name__ == '__main__':
    session.run(_main)

See https://docs.python.org/3/library/asyncio-future.html#asyncio.ensure_future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

readme example not async?

2 participants