def wait_for_url(self, url, timeout=5):
        end = time.time() + timeout

        while end >= time.time():
            try:
                status = urllib.urlopen(url).getcode()
                if status == 200:
                    return
            except IOError:
                time.sleep(1)

        raise RuntimeError('Url {0} is not available (waited {1} '
                           'seconds)'.format(url, timeout))
dataset/ETHPy150Open cloudify-cosmo/cloudify-manager/rest-service/manager_rest/test/base_test.py/BaseServerTestCase.wait_for_url/original