Repository: plotly/dash
File: dash/dash.py (Python)

Code before:
        url_base_pathname: Optional[str] = None,
        requests_pathname_prefix: Optional[str] = None,
        routes_pathname_prefix: Optional[str] = None,
        serve_locally: bool = True,
        compress: Optional[bool] = None,
        meta_tags: Optional[Sequence[Dict[str, Any]]] = None,
        index_string: str = _default_index,
        external_scripts: Optional[Sequence[Union[str, Dict[str, Any]]]] = None,
        external_stylesheets: Optional[Sequence[Union[str, Dict[str, Any]]]] = None,
        suppress_callback_exceptions: Optional[bool] = None,
        prevent_initial_callbacks: bool = False,
        show_undo_redo: bool = False,
        extra_hot_reload_paths: Optional[Sequence[str]] = None,
        plugins: Optional[list] = None,
        title: str = "Dash",
        update_title: str = "Updating...",
        background_callback_manager: Optional[
            Any
        ] = None,  # Type should be specified if possible
        add_log_handler: bool = True,
        hooks: Optional[RendererHooks] = None,
        routing_callback_inputs: Optional[Dict[str, Union[Input, State]]] = None,
        description: Optional[str] = None,
        on_error: Optional[Callable[[Exception], Any]] = None,
        use_async: Optional[bool] = None,
        health_endpoint: Optional[str] = "health",
        **obsolete,
    ):

        if use_async is None:
            try:
                import asgiref  # pylint: disable=unused-import, import-outside-toplevel # noqa

                use_async = True
            except ImportError:
                pass
        elif use_async:
            try:
                import asgiref  # pylint: disable=unused-import, import-outside-toplevel # noqa
            except ImportError as exc:
                raise Exception(
                    "You are trying to use dash[async] without having installed the requirements please install via: `pip install dash[async]`"
                ) from exc

        _validate.check_obsolete(obsolete)

        caller_name: str = name if name is not None else get_caller_name()

        # We have 3 cases: server is either True (we create the server), False
        # (defer server creation) or a Flask app instance (we use their server)
        if isinstance(server, flask.Flask):

Review comment (security):
May make sense to have a `None` option or similar to disable the health endpoint. There's some risk of a DDOS attack by leaving an endpoint unauthenticated so some developers may want to opt-out.

Code after:
        url_base_pathname: Optional[str] = None,
        requests_pathname_prefix: Optional[str] = None,
        routes_pathname_prefix: Optional[str] = None,
        serve_locally: bool = True,
        compress: Optional[bool] = None,
        meta_tags: Optional[Sequence[Dict[str, Any]]] = None,
        index_string: str = _default_index,
        external_scripts: Optional[Sequence[Union[str, Dict[str, Any]]]] = None,
        external_stylesheets: Optional[Sequence[Union[str, Dict[str, Any]]]] = None,
        suppress_callback_exceptions: Optional[bool] = None,
        prevent_initial_callbacks: bool = False,
        show_undo_redo: bool = False,
        extra_hot_reload_paths: Optional[Sequence[str]] = None,
        plugins: Optional[list] = None,
        title: str = "Dash",
        update_title: str = "Updating...",
        background_callback_manager: Optional[
            Any
        ] = None,  # Type should be specified if possible
        add_log_handler: bool = True,
        hooks: Optional[RendererHooks] = None,
        routing_callback_inputs: Optional[Dict[str, Union[Input, State]]] = None,
        description: Optional[str] = None,
        on_error: Optional[Callable[[Exception], Any]] = None,
        use_async: Optional[bool] = None,
        health_endpoint: Optional[str] = None,
        **obsolete,
    ):

        if use_async is None:
            try:
                import asgiref  # pylint: disable=unused-import, import-outside-toplevel # noqa

                use_async = True
            except ImportError:
                pass
        elif use_async:
            try:
                import asgiref  # pylint: disable=unused-import, import-outside-toplevel # noqa
            except ImportError as exc:
                raise Exception(
                    "You are trying to use dash[async] without having installed the requirements please install via: `pip install dash[async]`"
                ) from exc

        _validate.check_obsolete(obsolete)

        caller_name: str = name if name is not None else get_caller_name()

        # We have 3 cases: server is either True (we create the server), False
        # (defer server creation) or a Flask app instance (we use their server)
        if isinstance(server, flask.Flask):