{"id":430973,"date":"2025-03-02T16:30:14","date_gmt":"2025-03-02T13:30:14","guid":{"rendered":"https:\/\/mob25.com\/?p=430973"},"modified":"2025-05-07T22:28:56","modified_gmt":"2025-05-07T19:28:56","slug":"prigotovlenie-asinhronnogo-supa","status":"publish","type":"post","link":"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/","title":{"rendered":"\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430"},"content":{"rendered":"\n<p>\u0421\u0430\u043c\u0430\u044f \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u043a\u043e\u0440\u0438\u0442 \u0441\u0431\u043e\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0440\u0430\u0437.<\/p>\n\n\n\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0435\u0440\u0451\u0442 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430-\u0442\u0440\u0435\u043d\u0430\u0436\u0435\u0440\u0430 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0446\u0435\u043d\u044b. \u0411\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0432\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438, \u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u043e.<\/p>\n\n\n\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0430\u0436\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import aiohttp\nimport asyncio\nfrom bs4 import BeautifulSoup\n\nasync def main():\n\u00a0\u00a0\u00a0 url = 'https:\/\/mob25.com\/index1_page_1.html'\n\u00a0\u00a0\u00a0 async with aiohttp.ClientSession() as session:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 async with session.get(url=url, timeout=1) as response:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 soup = BeautifulSoup(await response.text(), 'lxml')\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 name = soup.find_all('a', class_='name_item')\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 price = soup.find_all('p', class_='price')\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for n, p in zip(name, price):\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(n.text, p.text)\nasyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\nasyncio.run(main())<\/pre>\n\n\n\n<p>\u0412\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u041a \u044d\u0442\u043e\u043c\u0443 \u044d\u0442\u0430\u043f\u0443 \u043a\u0443\u0440\u0441\u0430 \u0432\u044b \u0443\u0436\u0435 \u0443\u043c\u0435\u0435\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 &#171;\u0441\u0443\u043f\u043e\u043c&#187;, \u0438 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u044d\u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0442\u0438\u043b\u044f, \u0437\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u041a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e await, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 await response.text(). \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e await, \u0447\u0442\u043e\u0431\u044b \u0434\u0430\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0430\u0448\u0435\u043c\u0443 \u0446\u0438\u043a\u043b\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u0439, \u0433\u0434\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u043a\u0430 \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">soup = BeautifulSoup(await response.text(), 'lxml')<\/pre>\n\n\n\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430-\u0442\u0440\u0435\u043d\u0430\u0436\u0435\u0440\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0441 \u043a\u0430\u0440\u0442\u043e\u0447\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0430\u043c 160 \u0448\u0442\u0443\u043a: \u0446\u0435\u043d\u0443 \u0438 \u043d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0432\u0430\u0440\u0430.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import asyncio\nimport time\nimport aiohttp\n\nfrom bs4 import BeautifulSoup\n# ---------------------start block 1------------------------\ncategory = ['watch', 'mobile', 'mouse', 'hdd', 'headphones']\nurls = [f'https:\/\/mob25.com\/{cat}\/{i}\/{i}_{x}.html' for cat, i in zip(category, range(1, len(category) + 1)) for\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 x in range(1, 33)]\n# ---------------------end block 1------------------------\n\n# ---------------------start block 2------------------------\nasync def run_tasks(url, session):\n\u00a0\u00a0\u00a0 async with session.get(url) as resp:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 soup = BeautifulSoup(await resp.text(), 'lxml')\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 price = soup.find('span', id='price').text\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 name = soup.find('p', id='p_header').text\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(resp.url, price, name)\n# ---------------------end block 2------------------------\n\n# ---------------------start block 3------------------------\nasync def main():\n\u00a0\u00a0\u00a0 async with aiohttp.ClientSession() as session:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tasks = [run_tasks(link, session) for link in urls]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 await asyncio.gather(*tasks)\n# ---------------------end block 3------------------------\n\n# ---------------------start block 4------------------------\nif __name__ == '__main__':\n\u00a0\u00a0\u00a0 asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\n\u00a0\u00a0\u00a0 start = time.time()\n\u00a0\u00a0\u00a0 asyncio.run(main())\n\u00a0\u00a0\u00a0 print(time.time()-start)<\/pre>\n\n\n\n<p>&nbsp;\u0411\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u21161.<\/p>\n\n\n\n<p>\u0412 \u044d\u0442\u043e\u043c \u0431\u043b\u043e\u043a\u0435 \u043c\u044b \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043d\u0430\u0448 \u0441\u0430\u0439\u0442 \u0438 \u043f\u043e\u043d\u044f\u043b\u0438, \u0447\u0442\u043e \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0432\u0441\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u0445 \u0432\u0441\u0435 \u0441\u0440\u0430\u0437\u0443 \u0432 \u0446\u0438\u043a\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0439. \u042d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u043d\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438. \u0415\u0441\u043b\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0438\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438, \u043a\u043e\u0434 \u0434\u043e \u043d\u0438\u0445 \u043d\u0435 \u0434\u043e\u0431\u0435\u0440\u0451\u0442\u0441\u044f. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u043c\u0435\u0435\u0442 \u043f\u0440\u0430\u0432\u043e \u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437-\u0437\u0430 \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b. <\/p>\n\n\n\n<p>\u0411\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u2116 2.<\/p>\n\n\n\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u043e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e: \u0432\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u044d\u0442\u043e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u043c aiohttp, \u0438 \u043f\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043a\u043e\u0434\u0430 \u0432\u0441\u0451 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u043e. \u0412\u044b \u0443\u0436\u0435 \u043d\u0435\u043e\u0434\u043d\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 BeautifulSoup, \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e.<\/p>\n\n\n\n<p>\u0411\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u2116 3.<\/p>\n\n\n\n<p>\u0410 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435.<\/p>\n\n\n\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 aiohttp:<\/strong><\/p>\n\n\n\n<p>async with aiohttp.ClientSession() as session: \u0417\u0434\u0435\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u0441\u0441\u0438\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 aiohttp. \u041e\u0431\u044a\u0435\u043a\u0442 session \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u043c \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0441\u0435\u0441\u0441\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0431\u043b\u043e\u043a\u0430 async with.<\/p>\n\n\n\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d:<\/strong><\/p>\n\n\n\n<p><strong>tasks = [run_tasks(link, session) for link in urls]<\/strong>. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0440\u0443\u0442\u0438\u043d. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043f\u0438\u0441\u043a\u0430 \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 run_tasks \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438(\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0435\u0441\u0441\u0438\u0438). \u042d\u0442\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u0435\u0449\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f, \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n\n\n\n<p>\u041a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0432 Python \u2014 \u044d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c async def, \u0438 \u043e\u043d\u0430 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b. \u041e\u0434\u043d\u0430\u043a\u043e, \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0432 \u0446\u0438\u043a\u043b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/p>\n\n\n\n<p>\u0417\u0430\u0434\u0430\u0447\u0430 (asyncio.Task) \u2014 \u044d\u0442\u043e \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0435\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">async def run_tasks():\n\u00a0\u00a0\u00a0 tasks = [main(link) for link in urls]\n\u00a0\u00a0\u00a0 for x in tasks:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(type(x))\n\u00a0\u00a0\u00a0 await asyncio.gather(*tasks)\n\n\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:\n\u00a0\u00a0\u00a0 &lt;class 'coroutine'>\n\u00a0\u00a0\u00a0 &lt;class 'coroutine'>\n\u00a0\u00a0\u00a0 ...\n\u00a0\u00a0\u00a0 &lt;class 'coroutine'>\n\u00a0\u00a0\u00a0 &lt;class 'coroutine'><\/pre>\n\n\n\n<p><strong>\u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0443\u0442\u0438\u043d:<\/strong><\/p>\n\n\n\n<p>await asyncio.gather(*tasks): \u0417\u0434\u0435\u0441\u044c asyncio.gather \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0440\u0443\u0442\u0438\u043d \u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u041a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 tasks&nbsp; \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n\n\n\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f await asyncio.gather(*tasks) \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0430 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e await \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n\n\n\n<p>\u0411\u043b\u043e\u043a \u043a\u043e\u0434\u0430 \u2116 4.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">if __name__ == '__main__':\n\u00a0\u00a0\u00a0 asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\n\u00a0\u00a0\u00a0 start = time.time()\n\n\u200b\u200b\u200b\u200b\u200b\u200b\u200bif __name__ == '__main__':\n\u00a0\u00a0\u00a0 asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\n\u00a0\u00a0\u00a0 start = time.time()\n\u00a0\u00a0\u00a0 asyncio.run(main())\n\u00a0\u00a0\u00a0 print(time.time()-start)\n\u00a0\u00a0\u00a0 asyncio.run(main())\n\u00a0\u00a0\u00a0 print(time.time()-start)<\/pre>\n\n\n\n<p>\u200b\u200b\u200b\u200b<\/p>\n\n\n\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f asyncio.run(main()), \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0446\u0438\u043a\u043b \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0439 main(), \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n\n\n\n<p>\u0422\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n\n\n\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0438 \u043a\u043e\u0434 \u0443 \u0441\u0435\u0431\u044f \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435, \u0442\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043f\u0435\u0447\u0430\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0421\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u043e\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447.<\/p>\n\n\n\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439.<\/p>\n\n\n\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u0442\u0440\u043e\u0433\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c run_tasks() \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u043c\u0435\u0441\u0442\u043e print() \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d return:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">async def run_tasks(url, session):\n\u00a0\u00a0\u00a0 async with session.get(url) as resp:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 soup = BeautifulSoup(await resp.text(), 'lxml')\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 price = soup.find('span', id='price').text\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 name = soup.find('p', id='p_header').text\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 return resp.url, price, name<\/pre>\n\n\n\n<p>\u0410 \u0432 main() \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0441\u0435\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a result \u0438 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">async def main():\n\u00a0\u00a0\u00a0 async with aiohttp.ClientSession() as session:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tasks = [run_tasks(link, session) for link in urls]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0432\u0441\u0435\u0445 \u0437\u0430\u0434\u0430\u0447 \u0432 result\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 result = await asyncio.gather(*tasks)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 # \u0420\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 result\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for x in result:\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 print(*x, sep=', ')<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0421\u0430\u043c\u0430\u044f \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u043a\u043e\u0440\u0438\u0442 \u0441\u0431\u043e\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0440\u0430\u0437. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0435\u0440\u0451\u0442 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430-\u0442\u0440\u0435\u043d\u0430\u0436\u0435\u0440\u0430 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0446\u0435\u043d\u044b. \u0411\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0432\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438, \u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u043e. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[636],"tags":[],"class_list":["post-430973","post","type-post","status-publish","format-standard","","category-asinhronnyj-parsing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/\" \/>\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\" \/>\n<meta property=\"og:description\" content=\"\u0421\u0430\u043c\u0430\u044f \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u043a\u043e\u0440\u0438\u0442 \u0441\u0431\u043e\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0440\u0430\u0437. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0435\u0440\u0451\u0442 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430-\u0442\u0440\u0435\u043d\u0430\u0436\u0435\u0440\u0430 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0446\u0435\u043d\u044b. \u0411\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0432\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438, \u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u043e. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/\" \/>\n<meta property=\"og:site_name\" content=\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-02T13:30:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-07T19:28:56+00:00\" \/>\n<meta name=\"author\" content=\"mob25\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/\",\"url\":\"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/\",\"name\":\"\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\",\"isPartOf\":{\"@id\":\"https:\/\/mob25.com\/blog\/#website\"},\"datePublished\":\"2025-03-02T13:30:14+00:00\",\"dateModified\":\"2025-05-07T19:28:56+00:00\",\"author\":{\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/b0d0c762a30795904061f383c6401489\"},\"breadcrumb\":{\"@id\":\"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/#breadcrumb\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"https:\/\/mob25.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mob25.com\/blog\/#website\",\"url\":\"https:\/\/mob25.com\/blog\/\",\"name\":\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mob25.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ru-RU\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/b0d0c762a30795904061f383c6401489\",\"name\":\"mob25\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/mob25.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/05dedffa125e5e4b26ae62cae4b744be451eb149ece723607015970ac71dda28?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/05dedffa125e5e4b26ae62cae4b744be451eb149ece723607015970ac71dda28?s=96&d=mm&r=g\",\"caption\":\"mob25\"},\"sameAs\":[\"https:\/\/mob25.com\"],\"url\":\"https:\/\/mob25.com\/blog\/author\/mob25\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/","og_locale":"ru_RU","og_type":"article","og_title":"\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433","og_description":"\u0421\u0430\u043c\u0430\u044f \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0412 \u044d\u0442\u043e\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0441\u043a\u043e\u0440\u0438\u0442 \u0441\u0431\u043e\u0440 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0434\u0435\u0441\u044f\u0442\u043a\u0438 \u0440\u0430\u0437. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0430\u0440\u0441\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0435\u0440\u0451\u0442 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430-\u0442\u0440\u0435\u043d\u0430\u0436\u0435\u0440\u0430 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0438 \u0446\u0435\u043d\u044b. \u0411\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0432\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438, \u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0432\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0437\u043d\u0430\u043a\u043e\u043c\u043e. [&hellip;]","og_url":"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/","og_site_name":"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438","article_published_time":"2025-03-02T13:30:14+00:00","article_modified_time":"2025-05-07T19:28:56+00:00","author":"mob25","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/","url":"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/","name":"\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430 \u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433","isPartOf":{"@id":"https:\/\/mob25.com\/blog\/#website"},"datePublished":"2025-03-02T13:30:14+00:00","dateModified":"2025-05-07T19:28:56+00:00","author":{"@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/b0d0c762a30795904061f383c6401489"},"breadcrumb":{"@id":"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/#breadcrumb"},"inLanguage":"ru-RU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/mob25.com\/blog\/prigotovlenie-asinhronnogo-supa\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"https:\/\/mob25.com\/blog\/"},{"@type":"ListItem","position":2,"name":"\u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043f\u0430"}]},{"@type":"WebSite","@id":"https:\/\/mob25.com\/blog\/#website","url":"https:\/\/mob25.com\/blog\/","name":"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mob25.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ru-RU"},{"@type":"Person","@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/b0d0c762a30795904061f383c6401489","name":"mob25","image":{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/mob25.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/05dedffa125e5e4b26ae62cae4b744be451eb149ece723607015970ac71dda28?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/05dedffa125e5e4b26ae62cae4b744be451eb149ece723607015970ac71dda28?s=96&d=mm&r=g","caption":"mob25"},"sameAs":["https:\/\/mob25.com"],"url":"https:\/\/mob25.com\/blog\/author\/mob25\/"}]}},"_links":{"self":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts\/430973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/comments?post=430973"}],"version-history":[{"count":0,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/posts\/430973\/revisions"}],"wp:attachment":[{"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/media?parent=430973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/categories?post=430973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mob25.com\/blog\/wp-json\/wp\/v2\/tags?post=430973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}