jjmark15
5/25/2017 - 12:40 PM

Checks to see if there is an internet connection

Checks to see if there is an internet connection

import requests

def internet_on():
    for timeout in [1,5,10,15]:
        try:
            response=requests.get('http://google.com',timeout=timeout)
            return True
        except:
            print('No internet')
            pass
    return False