url1=['www.google.com', 'www.youtube.com', 'www.facebook.com']
async def dnsRec(url):
async with whois.whois(urlparse(url).netloc) as response:
domain_detail = response.json()
return domain_detail
async def main():
task = [dnsRec(i) for i in url1]
await asyncio.gather(*task)
def func():
asyncio.run(main())
func()
RuntimeError: asyncio.run() cannot be called from a running event loop