Created
May 5, 2022 12:12
-
-
Save coffeewasmyidea/3295a6cfa0d4e4b56ece689deea7d797 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import aiohttp | |
import asyncio | |
from timeit import default_timer as timer | |
from time import sleep | |
async def main(): | |
async with aiohttp.ClientSession() as session: | |
url_list = [ | |
"https://www.hellosign.com", | |
"https://code.org", | |
"https://codeweek.eu/", | |
"https://code.visualstudio.com", | |
"https://code.berlin/en", | |
"https://techcrunch.com/", | |
"https://www.confessionsofadataguy.com", | |
] * 1 | |
father_time = [] | |
for url in url_list: | |
t1 = timer() | |
async with session.get(url) as response: | |
html = await response.text() | |
sleep(0.1) | |
t2 = timer() | |
secs = t2 - t1 | |
father_time.append(secs) | |
for timerson in father_time: | |
print(timerson) | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment