INNER CODE UNIT · Python
takeover_fetch
XDeadHackerX/The_spy_job · requisitos/theHarvester/theHarvester/lib/core.py:305
async def takeover_fetch(session, url, proxy="") -> Union[Tuple[Any, Any], str]:
# This fetch method solely focuses on get requests
try:
# Wrap in try except due to 0x89 png/jpg files
# This fetch method solely focuses on get requests
# TODO determine if method for post requests is necessary
url = f'http://{url}' if str(url).startswith(('http:', 'https:')) is False else url
# Clean up urls with proper schemas
if proxy != "":
async with session.get(url, proxy=proxy) as response:
await asyncio.sleep(2)
return url, await response.text()
else:
async with session.get(url) as response:
await asyncio.sleep(2)
return url, await response.text()
except Exception:
return url, ''