Skip to content

Instantly share code, notes, and snippets.

@coffeewasmyidea
Created May 5, 2022 12:11
Show Gist options
  • Save coffeewasmyidea/106894cf5b9323a9163a07840ba89f01 to your computer and use it in GitHub Desktop.
Save coffeewasmyidea/106894cf5b9323a9163a07840ba89f01 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import aiohttp
import asyncio
import httpx
from timeit import default_timer as timer
from time import sleep
async def main():
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 httpx.AsyncClient() as client:
r = await client.get(url)
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