Last active
January 4, 2021 10:57
-
-
Save yasinkuyu/aa505c1f4bbb4016281d7167b8fa2fc2 to your computer and use it in GitHub Desktop.
Python Check Internet Connection
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
#@yasinkuyu 08/09/2017 | |
def check_internet(): | |
url='http://www.google.com/' | |
timeout=5 | |
try: | |
_ = requests.get(url, timeout=timeout) | |
return True | |
except requests.ConnectionError: | |
print("İnternet bağlantısı yok.") | |
return False | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@dwonga @resultuzen thx :)