Ниже часть кода main(), как запустить каждый task со случайным прокси из файла proxylist.txt?
proxy_files_path = 'data\\proxylist.txt'
app_storage['session'] = ClientSession()
async with ClientSession() as session:
await create_table(pool)
async with aiofiles.open(filename, 'r', encoding='utf-8') as file:
domains = [line.strip() for line in await file.readlines()]
current_date = datetime.datetime.now().strftime('%d-%m-%Y')
sem = asyncio.Semaphore(120)
tasks = []
for domain in domains:
index = domain.find('.')
if index != -1:
up_zone = domain[index:]
up_zone = up_zone[1:].upper()
tasks.append(get_domain_ip(sem, domain, pool, up_zone, geo_ip, current_date, agent))
for task in tqdm(asyncio.as_completed(tasks), total=len(tasks)):
await task