I want my python script to check for an active internet connection, and if there is one, then continue execution. If there is no connection, continue checking. Basically block execution in "main ()" until the script can reconnect.
Python
import urllib2
def main():
def internet_on():
try:
response=urllib2.urlopen('http://74.125.113.99',timeout=1)
main()
except urllib2.URLError:
internet_on()
source
share