Skip to content

panel

numerous.frameworks.panel

Module for integrating Numerous with Panel.

PanelCookieGetter

Source code in numerous/frameworks/panel.py
 9
10
11
12
13
14
15
16
17
18
19
class PanelCookieGetter:
    @staticmethod
    def cookies() -> dict[str, str]:
        """Get the cookies associated with the current request."""
        if is_local_mode():
            # Add the user info to the cookies on panel server
            session.set_user_info_cookie(pn.state.cookies, local_user)

        if pn.state.curdoc and pn.state.curdoc.session_context:
            return {key: str(val) for key, val in pn.state.cookies.items()}
        return {}

cookies() staticmethod

Get the cookies associated with the current request.

Source code in numerous/frameworks/panel.py
10
11
12
13
14
15
16
17
18
19
@staticmethod
def cookies() -> dict[str, str]:
    """Get the cookies associated with the current request."""
    if is_local_mode():
        # Add the user info to the cookies on panel server
        session.set_user_info_cookie(pn.state.cookies, local_user)

    if pn.state.curdoc and pn.state.curdoc.session_context:
        return {key: str(val) for key, val in pn.state.cookies.items()}
    return {}

get_session()

Get the session for the current user.

Returns:

Name Type Description
Session Session

The session for the current user.

Source code in numerous/frameworks/panel.py
22
23
24
25
26
27
28
29
30
def get_session() -> session.Session:
    """
    Get the session for the current user.

    Returns:
        Session: The session for the current user.

    """
    return session.Session(cg=PanelCookieGetter())