Skip to content

Instantly share code, notes, and snippets.

@dizballanze
Created January 16, 2015 14:15
Show Gist options
  • Save dizballanze/8d085aafec7a67b2540d to your computer and use it in GitHub Desktop.
Save dizballanze/8d085aafec7a67b2540d to your computer and use it in GitHub Desktop.
Check if internet is working
import subprocess
internet = False
while not internet:
try:
subprocess.check_call(["ping", "-c 1", "www.google.ru"])
print("Internet is up again!")
internet = True
except subprocess.CalledProcessError:
print("Internet is still down :(")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment