Skip to content

Instantly share code, notes, and snippets.

@thinkjson
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save thinkjson/a1dd76af455dceb8e4aa to your computer and use it in GitHub Desktop.

Select an option

Save thinkjson/a1dd76af455dceb8e4aa to your computer and use it in GitHub Desktop.
Check to see when DNS for a new host has propagated
import requests
import sys
import time
import subprocess
if len(sys.argv) != 2:
print 'Usage: new_host_DNS.py [url]'
sys.exit(0)
NX = True
while NX:
try:
response = requests.get(sys.argv[1])
NX = False
except requests.exceptions.ConnectionError:
sys.stdout.write('.')
sys.stdout.flush()
time.sleep(1)
print ''
print 'DNS has propagated'
subprocess.call(['say', 'DNS', 'has', 'propagated'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment