Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add detection if internet connect is present or not #6

Open
berrisfordjohn opened this issue Sep 21, 2018 · 1 comment
Open

add detection if internet connect is present or not #6

berrisfordjohn opened this issue Sep 21, 2018 · 1 comment

Comments

@berrisfordjohn
Copy link
Owner

only do remote calls when internet connection is present

@berrisfordjohn
Copy link
Owner Author

From Eugene

def have_internet ( self,url="www.google.com",time_out=5 ):
conn = httplib.HTTPConnection(url,timeout=time_out)
try:
conn.request("HEAD", "/")
conn.close()
return True
except:
conn.close()
return False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant