Answers for "python detect internet connection whenever available"

2

python check if internet is available

import urllib.request

def internet_on():
    try:
        urllib.request.urlopen('http://216.58.192.142', timeout=2)
        return True
    except:
        return False
Posted by: Guest on December-30-2020

Code answers related to "python detect internet connection whenever available"

Python Answers by Framework

Browse Popular Code Answers by Language