Last active
September 11, 2019 22:52
-
-
Save SofianeHamlaoui/a33cc85222a0b9400a757386262a7b1e to your computer and use it in GitHub Desktop.
Check Internet Connection , Check Network Connection Python
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
def checkconnect(): | |
url='http://www.google.com/' | |
try: | |
_ = requests.get(url, timeout=2) | |
return True | |
except requests.ConnectionError: | |
exit(" \033[1;33;40m-[!]- YOU NEED INTERNET CONNECTION CONTINUE -[!]-\033[0m") | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment