// Language: Python
import asyncio, aiohttp
async def fetch(session, url):
async with session.get(url) as r:
return url, r.status
async def main():
urls = ['https://example.com', 'https://api.github.com/zen']
async with aiohttp.ClientSession() as s:
results = await asyncio.gather(*(fetch(s, u) for u in urls))
for u, code in results:
print(u, code)
asyncio.run(main())