# pip install pythonping from pythonping import ping def internet_connected(test_ip_address="8.8.8.8"): return ping(test_ip_address).success()