avatar Bite 335. Async HTTP client

Your task in this Bite is to create an http client that will asynchronously send http requests and process responses.

This Bite is focused on using asyncio, so you are expected to write async function.

To demonstrate power of asynchronous requests you will have to implement function that is able to send 100 requests and get results in 0.5 seconds, despite the fact that each request will take around 0.1 second for the server to respond to!

This is impossible without concurrent requests. (The test server is able to handle concurrent requests.)

For a detailed task description read the docstrings of the function that you are supposed to implement: get_results_from_urls.

Useful links

- Python docs: asyncio — Asynchronous I/O

AIOHTTP docs

- Async IO in Python: A Complete Walkthrough

Login and get coding
go back Intermediate level
Bitecoin 3X

14 out of 16 users completed this Bite.
Will you be Pythonista #15 to crack this Bite?
Resolution time: ~123 min. (avg. submissions of 5-240 min.)

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help