Skip to content

Instantly share code, notes, and snippets.

@NiklasMM
Created February 19, 2020 14:45
Show Gist options
  • Save NiklasMM/27ac1d4bc0760dc7d5556b40767748f1 to your computer and use it in GitHub Desktop.
Save NiklasMM/27ac1d4bc0760dc7d5556b40767748f1 to your computer and use it in GitHub Desktop.
Check for websites directly hosted on tld
import requests
from tlds import tld_set
for tld in tld_set:
try:
requests.get(f"https://{tld}")
except requests.exceptions.RequestException:
print(f"Failed to connect to {tld}")
else:
print(f"{tld} works!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment