voila/utils.py
def wait_for_request(url: str = None) -> str:
    """Helper function to pause the execution of notebook and wait for
    the pre-heated kernel to be used and all request info is added to
    the environment.

    Args:
        url (str, optional): Address to get request info, if it is not
        provided, `voila` will figure out from the environment variables.
        Defaults to None.

    """
    preheat_mode = os.getenv(ENV_VARIABLE.VOILA_PREHEAT, 'False')
    if preheat_mode == 'False':
        return

    request_info = None
    if url is None:
        protocol = os.getenv(ENV_VARIABLE.VOILA_WS_PROTOCOL, 'ws')
        server_ip = os.getenv(ENV_VARIABLE.VOILA_APP_IP, '127.0.0.1')
        server_port = os.getenv(ENV_VARIABLE.VOILA_APP_PORT, '8866')
        server_url = os.getenv(ENV_VARIABLE.VOILA_SERVER_URL, '/')
        # Use `VOILA_SERVER_URL` if `VOILA_WS_BASE_URL` not specified.
        ws_base_url = os.getenv(ENV_VARIABLE.VOILA_WS_BASE_URL, server_url)
        url = f'{protocol}://{server_ip}:{server_port}{ws_base_url}voila/query'

    kernel_id = os.getenv(ENV_VARIABLE.VOILA_KERNEL_ID)
    ws_url = f'{url}/{kernel_id}'

    def inner():
        nonlocal request_info
        loop = asyncio.new_event_loop()
        request_info = loop.run_until_complete(_get_request_info(ws_url))

    thread = threading.Thread(target=inner)
    try:
        thread.start()
        thread.join()
    except (KeyboardInterrupt, SystemExit):
        asyncio.get_event_loop().stop()

    if request_info is not None:
        for k, v in json.loads(request_info).items():
            os.environ[k] = v
Helper function to pause the execution of notebook and wait for
    the pre-heated kernel to be used and all request info is added to
    the environment.

    Args:
        url (str, optional): Address to get request info, if it is not
        provided, `voila` will figure out from the environment variables.
        Defaults to None.

    
Helper function to pause the execution of notebook and wait for
the pre-heated kernel to be used and all request info is added to
the environment.

url (str, optional): Address to get request info, if it is not
provided, `voila` will figure out from the environment variables.
Defaults to None.
Helper function to pause the execution of notebook and wait for the pre - heated kernel to be used and all request info is added to the environment . url ( str optional ) : Address to get request info if it is not provided ` voila ` will figure out from the environment variables . Defaults to None .
def wait_for_request(url: str = None) -> str:
    preheat_mode = os.getenv(ENV_VARIABLE.VOILA_PREHEAT, 'False')
    if preheat_mode == 'False':
        return
    request_info = None
    if url is None:
        protocol = os.getenv(ENV_VARIABLE.VOILA_WS_PROTOCOL, 'ws')
        server_ip = os.getenv(ENV_VARIABLE.VOILA_APP_IP, '127.0.0.1')
        server_port = os.getenv(ENV_VARIABLE.VOILA_APP_PORT, '8866')
        server_url = os.getenv(ENV_VARIABLE.VOILA_SERVER_URL, '/')
        ws_base_url = os.getenv(ENV_VARIABLE.VOILA_WS_BASE_URL, server_url)
        url = f'{protocol}://{server_ip}:{server_port}{ws_base_url}voila/query'
    kernel_id = os.getenv(ENV_VARIABLE.VOILA_KERNEL_ID)
    ws_url = f'{url}/{kernel_id}'
    def inner():
        nonlocal request_info
        loop = asyncio.new_event_loop()
        request_info = loop.run_until_complete(_get_request_info(ws_url))
    thread = threading.Thread(target=inner)
    try:
        thread.start()
        thread.join()
    except (KeyboardInterrupt, SystemExit):
        asyncio.get_event_loop().stop()
    if request_info is not None:
        for k, v in json.loads(request_info).items():
            os.environ[k] = v
def wait_for_request ( url : str = None ) -> str : preheat_mode = os . getenv ( ENV_VARIABLE . VOILA_PREHEAT , 'False' ) if preheat_mode == 'False' : return request_info = None if url is None : protocol = os . getenv ( ENV_VARIABLE . VOILA_WS_PROTOCOL , 'ws' ) server_ip = os . getenv ( ENV_VARIABLE . VOILA_APP_IP , '127.0.0.1' ) server_port = os . getenv ( ENV_VARIABLE . VOILA_APP_PORT , '8866' ) server_url = os . getenv ( ENV_VARIABLE . VOILA_SERVER_URL , '/' ) ws_base_url = os . getenv ( ENV_VARIABLE . VOILA_WS_BASE_URL , server_url ) url = f'{protocol}://{server_ip}:{server_port}{ws_base_url}voila/query' kernel_id = os . getenv ( ENV_VARIABLE . VOILA_KERNEL_ID ) ws_url = f'{url}/{kernel_id}' def inner ( ) : nonlocal request_info loop = asyncio . new_event_loop ( ) request_info = loop . run_until_complete ( _get_request_info ( ws_url ) ) thread = threading . Thread ( target = inner ) try : thread . start ( ) thread . join ( ) except ( KeyboardInterrupt , SystemExit ) : asyncio . get_event_loop ( ) . stop ( ) if request_info is not None : for k , v in json . loads ( request_info ) . items ( ) : os . environ [ k ] = v
Helper function to pause the execution of notebook and wait for
the pre-heated kernel to be used and all request info is added to
the environment.
Helper function to pause the execution of notebook and wait for the pre - heated kernel to be used and all request info is added to the environment .
"""Helper function to pause the execution of notebook and wait for
    the pre-heated kernel to be used and all request info is added to
    the environment.

    Args:
        url (str, optional): Address to get request info, if it is not
        provided, `voila` will figure out from the environment variables.
        Defaults to None.

    """ # Use `VOILA_SERVER_URL` if `VOILA_WS_BASE_URL` not specified.
url
str