aiohttp 模块

import aiohttp
import asyncio


async def aaa():
    async with aiohttp.ClientSession() as session:
        async with session.get('https://github.com') as response:
            if response.status == 200:
                print('ok')


loop = asyncio.get_event_loop()
tasks = [aaa()]
loop.run_until_complete(asyncio.wait(tasks))

  

posted @ 2018-04-14 16:51  qukaige  阅读(151)  评论(0编辑  收藏  举报