def open_browser_and_wait(
    target_url: str, poll_url: str, interval: int = 2
) -> httpx.Response:
    """Open a browser window to target_url and request poll_url until it returns successfully.

    Args:
        target_url: The URL to open in the browser.
        poll_url: The URL to poll for success.
        interval: The interval in seconds to wait between polling.

    Returns:
        The response from the poll_url.
    """
    open_browser(target_url)
    console.info("[b]Complete the workflow in the browser to continue.[/b]")
    while True:
        try:
            response = net.get(poll_url, follow_redirects=True)
            if response.is_success:
                break
        except httpx.RequestError as err:
            console.info(f"Will retry after error occurred while polling: {err}.")
        time.sleep(interval)
    return response
Open a browser window to target_url and request poll_url until it returns successfully.

    Args:
        target_url: The URL to open in the browser.
        poll_url: The URL to poll for success.
        interval: The interval in seconds to wait between polling.

    Returns:
        The response from the poll_url.
    
reflex/utils/redir.py