MCPcopy Create free account
hub / github.com/Coooolfan/onlyboxes / wait_console_ready

Function wait_console_ready

scripts/install.py:457–474  ·  view source on GitHub ↗
(http_port: int, admin_password: str)

Source from the content-addressed store, hash-verified

455
456
457def wait_console_ready(http_port: int, admin_password: str) -> None:
458 info("Waiting for console to become ready...")
459 url = f"http://127.0.0.1:{http_port}/api/v1/console/session"
460 deadline = time.monotonic() + CONSOLE_READY_TIMEOUT
461 while time.monotonic() < deadline:
462 try:
463 req = urllib.request.Request(url)
464 with urllib.request.urlopen(req, timeout=5):
465 pass
466 _print_console_ready(http_port, admin_password)
467 return
468 except urllib.error.HTTPError:
469 _print_console_ready(http_port, admin_password)
470 return
471 except (urllib.error.URLError, OSError):
472 time.sleep(POLL_INTERVAL)
473
474 fatal("console", f"Console did not become ready within {CONSOLE_READY_TIMEOUT}s.")
475
476
477def _print_console_ready(http_port: int, admin_password: str) -> None:

Callers 1

mainFunction · 0.85

Calls 3

infoFunction · 0.85
_print_console_readyFunction · 0.85
fatalFunction · 0.70

Tested by

no test coverage detected