tools/python/google/httpd_utils.py
def UrlIsAlive(url):
  """Checks to see if we get an http response from |url|.
  We poll the url 5 times with a 1 second delay.  If we don't
  get a reply in that time, we give up and assume the httpd
  didn't start properly.

  Args:
    url: The URL to check.
  Return:
    True if the url is alive.
  """
  wait_time = 5
  while wait_time > 0:
    try:
      response = urllib.urlopen(url)
      # Server is up and responding.
      return True
    except IOError:
      pass
    wait_time -= 1
    # Wait a second and try again.
    time.sleep(1)

  return False
Checks to see if we get an http response from |url|.
  We poll the url 5 times with a 1 second delay.  If we don't
  get a reply in that time, we give up and assume the httpd
  didn't start properly.

  Args:
    url: The URL to check.
  Return:
    True if the url is alive.
  
Checks to see if we get an http response from |url|.
We poll the url 5 times with a 1 second delay.  If we don't
get a reply in that time, we give up and assume the httpd
didn't start properly.
Checks to see if we get an http response from |url| . We poll the url 5 times with a 1 second delay . If we don ' t get a reply in that time we give up and assume the httpd didn ' t start properly .
def UrlIsAlive(url):
  wait_time = 5
  while wait_time > 0:
    try:
      response = urllib.urlopen(url)
      return True
    except IOError:
      pass
    wait_time -= 1
    time.sleep(1)
  return False
def UrlIsAlive ( url ) : wait_time = 5 while wait_time > 0 : try : response = urllib . urlopen ( url ) return True except IOError : pass wait_time -= 1 time . sleep ( 1 ) return False
Checks to see if we get an http response from |url|.
Checks to see if we get an http response from |url| .
"""Checks to see if we get an http response from |url|.
  We poll the url 5 times with a 1 second delay.  If we don't
  get a reply in that time, we give up and assume the httpd
  didn't start properly.

  Args:
    url: The URL to check.
  Return:
    True if the url is alive.
  """ # Server is up and responding. # Wait a second and try again.
url
The URL to check.
The URL to check .