Skip to content

Instantly share code, notes, and snippets.

@kangchihlun
Created March 31, 2020 22:14
Show Gist options
  • Save kangchihlun/e8ccae61bca5f2774c376c55c6180380 to your computer and use it in GitHub Desktop.
Save kangchihlun/e8ccae61bca5f2774c376c55c6180380 to your computer and use it in GitHub Desktop.
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