async http requests python - Aiohttp 1

async http requests python – Aiohttp

url: https://docs.aiohttp.org/en/stable/
pip install aiohttp

Here is what the above code is Doing:
1. Importing the aiohttp library
2. Creating a function called fetch() that takes a url as an argument
3. Using the asyncio library to create a coroutine called fetch_async()
4. Using the aiohttp library to create a session object
5. Using the session object to make a GET request to the url passed to the fetch() function
6. Returning the response object
7. Creating a loop object
8. Using the loop object to run the fetch_async() coroutine
9. Printing the response object

Similar Posts