摘要:
import asyncio import aiohttp CONCURRENCY = 5 URL = 'https://www.baidu.com' semaphore = asyncio.Semaphore(CONCURRENCY) session = None async def scrape 阅读全文
posted @ 2025-12-28 11:52
chenlight
阅读(6)
评论(0)
推荐(0)
摘要:
在 Python 中,如果你定义了一个 协程函数(coroutine function),例如: async def funa(): ... 那么 funa() 本身并不会立即执行,而是返回一个 协程对象(coroutine object)。要真正“启动”或“运行”这个协程函数,有以下几种常见方式: 阅读全文
posted @ 2025-12-28 10:51
chenlight
阅读(2)
评论(0)
推荐(0)
摘要:
import asyncio import aiohttp import time start = time.time() async def get(url): session = aiohttp.ClientSession() response = await session.get(url) 阅读全文
posted @ 2025-12-28 09:59
chenlight
阅读(11)
评论(0)
推荐(0)

浙公网安备 33010602011771号