async def existance(s, name):
async with s.head(f"https://example.com/{name}") as r1:
if r1.status == 404:
print('wow i worked')
async def process(names):
with ThreadPoolExecutor(max_workers=3) as executor:
async with aiohttp.ClientSession() as s:
loop = asyncio.get_event_loop()
tasks = []
for name in names:
if len(name) >= 5 and len(name) < 16 and name.isalnum():
task = loop.run_in_executor(
executor,
existance,
*(s, name)
)
tasks.append(task)
return await asyncio.gather(*tasks)
while True:
start_time = time.time()
loop = asyncio.get_event_loop()
future = asyncio.ensure_future(process(names))
loop.run_until_complete(future)
I'm using the code above to try and split my tasks created across multiple threads while checking them all asynchronously.
I'm getting this error:
RuntimeWarning: coroutine 'existance' was never awaited
future = asyncio.ensure_future(process(names))
I'm still somewhat of a python beginner and I can't really figure out what I should change here to get the result I want. Any help is appreciated and I'm sorry if this is a duplicate question.