import urllib.request, urllib.error def getStatus(server): try: source = str(urllib.request.urlopen("https://sks-keyservers.net/status/ks-status.php?server=%s" % server).read()) if "No data found for keyserver" in source: return False if "Reason" in source: return False return True except urllib.error.URLError: return None