Thanks everybody for the answers. It was very enlightening. Here's my solution:
# using rich console def ensure_internet(): console = Console() domains = [ 'https://google.com', 'https://yahoo.com', 'https://bing.com', 'https://www.ecosia.org', 'https://www.wikipedia.org' ] results = [] with console.status("Checking internet ...", spinner="dots"): for domain in domains: try: requests.get(domain) results.append(1) except Exception as e: results.append(0) if not any(results): print('No internet connection') sys.exit() gist link: https://gist.github.com/Abdur-rahmaanJ/7917dc5ab7f5d2aa37b2723909be08f7 I think for me having the internet means ability to request urls Kind Regards, Abdur-Rahmaan Janhangeer about <https://compileralchemy.github.io/> | blog <https://www.pythonkitchen.com> github <https://github.com/Abdur-RahmaanJ> Mauritius -- https://mail.python.org/mailman/listinfo/python-list