Skip to content

async/await example question #4

@amejia1

Description

@amejia1

I'm not that familiar with this new AsyncSession object, but it looks to me like the async/await example doesn't actually perform those GET requests concurrently as you are awaiting for each one to return one by one. Should that example be this instead?

async def _main():
    for future in asyncio.as_completed([session.get('http://httpbin.org/get') for _ in range(100)]):
        print(await future)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions