import aiohttp
import asyncio
async def fetch(session, url):
async with session.get(url) as response:
return await response.text()
async def main():
async with aiohttp.ClientSession() as session:
html = await fetch(session, 'http://www.baidu.com')
print(html)
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
aiohttp简单的客户端
最新推荐文章于 2024-08-14 08:15:00 发布
