Created
March 31, 2020 22:14
-
-
Save kangchihlun/e8ccae61bca5f2774c376c55c6180380 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
import asyncio | |
import aiohttp | |
async def get_html(session, url): | |
async with session.get(url) as res: | |
return await res.text() | |
async def main(): | |
urls = [ | |
'http://python.org', | |
'http://google.com', | |
'' | |
] | |
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session: | |
html = await get_html(session, 'http://python.org') | |
print(len(html)) | |
asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment