コード例 #1
0
def _open_webbrowser(url: str, pid: int, port: int):
    """Open webbrowser with url when http service is started.

    If some error then do nothing.
    """
    logger = logging.getLogger('mindsdb.http')
    try:
        is_http_active = wait_func_is_true(func=is_pid_listen_port,
                                           timeout=10,
                                           pid=pid,
                                           port=port)
        if is_http_active:
            webbrowser.open(url)
    except Exception as e:
        logger.error(f'Failed to open {url} in webbrowser with exception {e}')
        logger.error(traceback.format_exc())
コード例 #2
0
ファイル: initialize.py プロジェクト: stjordanis/mindsdb
def _open_webbrowser(url: str, pid: int, port: int, init_static_thread, static_folder):
    """Open webbrowser with url when http service is started.

    If some error then do nothing.
    """
    init_static_thread.join()
    inject_telemetry_to_static(static_folder)
    logger = get_log('http')
    try:
        is_http_active = wait_func_is_true(func=is_pid_listen_port, timeout=10,
                                           pid=pid, port=port)
        if is_http_active:
            webbrowser.open(url)
    except Exception as e:
        logger.error(f'Failed to open {url} in webbrowser with exception {e}')
        logger.error(traceback.format_exc())
    session.close()