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))

  

原文地址:https://www.cnblogs.com/412013cl/p/8832787.html