Created
January 16, 2015 14:15
-
-
Save dizballanze/8d085aafec7a67b2540d to your computer and use it in GitHub Desktop.
Check if internet is working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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