My code:
import aiohttp
import asyncio
connector = aiohttp.TCPConnector(limit=1)
async def get(url):
print('started thread', url)
session = aiohttp.ClientSession(connector=connector)
response = await session.get(url, timeout=5)
await session.close()
print(await response.text())
loop = asyncio.get_event_loop()
tasks = [
loop.create_task(get('http://httpbin.org/ip')),
loop.create_task(get('http://httpbin.org/ip')),
loop.create_task(get('http://httpbin.org/ip')),
loop.create_task(get('http://httpbin.org/ip')),
loop.create_task(get('http://httpbin.org/ip')),
loop.create_task(get('http://httpbin.org/ip')),
]
loop.run_until_complete(asyncio.wait(tasks))
connector.close()
After 1 request, i get error: aiohttp.client_exceptions.ClientConnectionError: Connector is closed.