semaphore = asyncio.Semaphore(100) async with semaphore: async with aiohttp.ClientSession() as session: async with session.post(url, data=data, headers=header) as res: if int(res.status) == 200: text = await res.json(encoding="utf-8") print(text) return text
from asyncio import ProactorEventLoop asyncio.set_event_loop(ProactorEventLoop()) loop = asyncio.get_event_loop()
# 源碼 if sys.platform == 'win32': ProactorEventLoop: Type[AbstractEventLoop]