Created
February 19, 2020 14:45
-
-
Save NiklasMM/27ac1d4bc0760dc7d5556b40767748f1 to your computer and use it in GitHub Desktop.
Check for websites directly hosted on tld
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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