Created
November 16, 2017 11:00
-
-
Save tritium21/1f964078a14f7f9435234d572288a9f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import asyncio | |
| import aiohttp | |
| URLS = [ | |
| "https://google.com", | |
| "https://github.com", | |
| "https://example.org", | |
| ] | |
| DONE = {} | |
| async def main(): | |
| async with aiohttp.ClientSession() as session: | |
| for url in URLS: | |
| async with session.get(url) as resp: | |
| text = await resp.text() | |
| DONE[url] = len(text) | |
| print(DONE) | |
| asyncio.get_event_loop().run_until_complete(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment