def wait_for_url ( url , timeout = DEFAULT_TIMEOUT ) : service = ServiceURL ( url , timeout ) return service . wait ( )
how to gracefully handle timeout http python
Return True if connection to the host and port specified in url is successful within the timeout .
def wait_for_url(url, timeout=DEFAULT_TIMEOUT):
    """
    Return True if connection to the host and port specified in url
    is successful within the timeout.

    @param url: str: connection url for a TCP service
    @param timeout: int: length of time in seconds to try to connect before giving up
    @raise RuntimeError: if no port is given or can't be guessed via the scheme
    @return: bool
    """
    service = ServiceURL(url, timeout)
    return service.wait()