コード例 #1
0
ファイル: network.py プロジェクト: xy2/Cactus
def internetWorking():
    def check(url):
        try:
            response = urllib2.urlopen(url, timeout=1)
            return True
        except urllib2.URLError as err:
            pass
        return False

    return True in multiMap(check,
                            ['http://www.google.com', 'http://www.apple.com'])
コード例 #2
0
ファイル: network.py プロジェクト: dreadatour/Cactus
def internetWorking():
    def check(url):
        try:
            urllib.request.urlopen(url, timeout=1)
            return True
        except urllib.error.URLError:
            pass
        return False

    return True in multiMap(check, [
        'http://www.google.com',
        'http://www.apple.com'])
コード例 #3
0
ファイル: network.py プロジェクト: ateszdn/Cactus
def internetWorking():
    def check(url):
        try:
            response = urllib2.urlopen(url, timeout = 1)
            return True
        except urllib2.URLError as err:
            pass
        return False

    return True in multiMap(check, [
        'http://www.google.com',
        'http://www.apple.com'])