parameters: (name, url, timeout=10)
docstring: Simple connection test
docstring_summary: Simple connection test
docstring_tokens: Simple connection test
function: def test_connection(name, url, timeout=10):
      """Simple connection test"""
      urlinfo = urlparse(url)
      start = time.time()
      try:
          ip = socket.gethostbyname(urlinfo.netloc)
      except Exception as e:
          print('Error resolving DNS for {}: {}, {}'.format(name, url, e))
          return
      dns_elapsed = time.time() - start
      start = time.time()
      try:
          _ = urlopen(url, timeout=timeout)
      except Exception as e:
          print("Error open {}: {}, {}, DNS finished in {} sec.".format(name, url, e, dns_elapsed))
          return
      load_elapsed = time.time() - start
      print("Timing for {}: {}, DNS: {:.4f} sec, LOAD: {:.4f} sec.".format(name, url, dns_elapsed, load_elapsed))
function_tokens: def test_connection ( name , url , timeout = 10 ) : urlinfo = urlparse ( url ) start = time . time ( ) try : ip = socket . gethostbyname ( urlinfo . netloc ) except Exception as e : print ( 'Error resolving DNS for {}: {}, {}' . format ( name , url , e ) ) return dns_elapsed = time . time ( ) - start start = time . time ( ) try : _ = urlopen ( url , timeout = timeout ) except Exception as e : print ( "Error open {}: {}, {}, DNS finished in {} sec." . format ( name , url , e , dns_elapsed ) ) return load_elapsed = time . time ( ) - start print ( "Timing for {}: {}, DNS: {:.4f} sec, LOAD: {:.4f} sec." . format ( name , url , dns_elapsed , load_elapsed ) )