INNER CODE UNIT · Python
fetch_all
XDeadHackerX/The_spy_job · requisitos/theHarvester/theHarvester/lib/core.py:325
async def fetch_all(cls, urls, headers='', params='', json=False, takeover=False, proxy=False) -> list:
# By default timeout is 5 minutes, 60 seconds should suffice
timeout = aiohttp.ClientTimeout(total=60)
if len(headers) == 0:
headers = {'User-Agent': Core.get_user_agent()}
if takeover:
async with aiohttp.ClientSession(headers=headers, timeout=aiohttp.ClientTimeout(total=15)) as session:
if proxy:
tuples = await asyncio.gather(
*[AsyncFetcher.takeover_fetch(session, url, proxy=random.choice(cls().proxy_list)) for url in
urls])
return tuples
else:
tuples = await asyncio.gather(*[AsyncFetcher.takeover_fetch(session, url) for url in urls])
return tuples
if len(params) == 0:
async with aiohttp.ClientSession(headers=headers, timeout=timeout) as session: