INNER CODE UNIT · Python

shutdown

codeskyblue/uiautodev · uiautodev/cli.py:183

def shutdown(port: int):
    try:
        httpx.get(f"http://127.0.0.1:{port}/shutdown", timeout=3)
    except httpx.HTTPError:
        pass


def open_browser_when_server_start(local_server_url: str, offline: bool = False):
    deadline = time.time() + 10
    while time.time() < deadline:
        try:
            httpx.get(f"{local_server_url}/api/info", timeout=1)
            break
        except Exception as e:
            time.sleep(0.5)
    import webbrowser
    web_url = get_webpage_url(local_server_url if offline else None)
    logger.info("open browser: %s", web_url)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…