Многие ThreadPoolExecutor запускают aioHTTP - PullRequest
0 голосов
/ 02 августа 2020

Я не думаю, что правильно отбрасываю Thread. Каждый раз открывается новый поток. В VSCode я вижу по одному ThreadPoolExecutor для каждой операции получения, пример кода ниже.

import asyncio
import aiohttp
async def teste_get():
    async with aiohttp.ClientSession(headers={'accept' : 'application/json'}) as client_http:
        async with client_http.get("https://httpbin.org/json") as target:
            retorno = await target.json()
    await asyncio.sleep(2)
.
.
.
    async with aiohttp.ClientSession(headers={'accept' : 'application/json'}) as client_http:
        async with client_http.get("https://httpbin.org/json") as target:
            retorno = await target.json()
    await asyncio.sleep(2)

if __name__ == "__main__":
    asyncio.run(teste_get())```

[print VSCode][1]
  [1]: https://i.stack.imgur.com/xoJZZ.png
...