Skip to content

Instantly share code, notes, and snippets.

@Softwave
Created December 8, 2012 22:22
Show Gist options
  • Save Softwave/4242239 to your computer and use it in GitHub Desktop.
Save Softwave/4242239 to your computer and use it in GitHub Desktop.
Checks connection
import urllib2
import sys
try:
urllib2.urlopen("http://www.google.com/", timeout=2)
print "Your connection appears to be working"
except urllib2.URLError:
print "Your connection appears to be down"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment