Skip to content

jupyter

jupyter

Jupyter authentication classes for Domo.

DomoJupyterAuth

Mixin for Jupyter auth. Not instantiable alone.

Provides jupyter_token, service_location, service_prefix validation and jupyter_auth_header. Use DomoJupyterFullAuth or DomoJupyterTokenAuth.

jupyter_auth_header property

jupyter_auth_header: dict

Header for Jupyter server API (Authorization: Token ...).

DomoJupyterFullAuth dataclass

DomoJupyterFullAuth(
    jupyter_token: str,
    service_location: str,
    service_prefix: str,
    domo_instance: str,
    domo_username: str,
    domo_password: str,
    token_name: str | None = None,
    token: str | None = None,
    user_id: str | None = None,
    is_valid_token: bool = False,
    cache_responses: bool = False,
    cache_size: int = 1000,
    cache_default_ttl: int = 300,
    cache_strategy: str | None = None,
    custom_cache_rules: dict[str, list[str]] | None = None,
)

Bases: DomoJupyterAuth, DomoAuth

Jupyter authentication using full credentials (username/password).

auth_header property

auth_header: dict

Combined Domo + Jupyter headers (no guard — Jupyter token always present).

convert_auth classmethod

convert_auth(
    auth: DomoFullAuth,
    jupyter_token: str,
    service_location: str,
    service_prefix: str,
) -> DomoJupyterFullAuth

Create DomoJupyterFullAuth from DomoFullAuth + Jupyter params.

Source code in src/crew_dcs/auth/jupyter.py
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
@classmethod
def convert_auth(
    cls,
    auth: DomoFullAuth,
    jupyter_token: str,
    service_location: str,
    service_prefix: str,
) -> "DomoJupyterFullAuth":
    """Create DomoJupyterFullAuth from DomoFullAuth + Jupyter params."""
    return cls(
        domo_instance=auth.domo_instance,
        domo_username=auth.domo_username,
        domo_password=auth.domo_password,
        jupyter_token=jupyter_token,
        service_location=service_location,
        service_prefix=service_prefix,
        token_name=auth.token_name,
        token=auth.token,
        user_id=auth.user_id,
        is_valid_token=auth.is_valid_token,
    )

get_auth_token async

get_auth_token(
    return_raw: bool = False, **context_kwargs
) -> str | ResponseGetData

Retrieve the authentication token from product APIs.

Source code in src/crew_dcs/auth/jupyter.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@log_call(
    level_name="auth",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_auth_token(
    self,
    return_raw: bool = False,
    **context_kwargs,
) -> str | ResponseGetData:
    """Retrieve the authentication token from product APIs."""
    from ..routes import auth as auth_routes

    res = await auth_routes.get_full_auth(
        auth=None,
        domo_instance=self.domo_instance,
        domo_username=self.domo_username,
        domo_password=self.domo_password,
        parent_class=self.__class__.__name__,
        **context_kwargs,
    )

    if return_raw:
        return res

    if res.is_success and res.response:
        self.is_valid_token = True
        token = str(res.response.get("sessionToken", ""))
        self.token = token
        self.token_name = self.token_name or "full_auth"

    if not self.token:
        raise AuthError(message="Failed to retrieve authentication token")

    return self.token

DomoJupyterTokenAuth dataclass

DomoJupyterTokenAuth(
    jupyter_token: str,
    service_location: str,
    service_prefix: str,
    domo_instance: str,
    domo_access_token: str,
    token_name: str | None = None,
    token: str | None = None,
    user_id: str | None = None,
    is_valid_token: bool = False,
    cache_responses: bool = False,
    cache_size: int = 1000,
    cache_default_ttl: int = 300,
    cache_strategy: str | None = None,
    custom_cache_rules: dict[str, list[str]] | None = None,
)

Bases: DomoJupyterAuth, DomoAuth

Jupyter authentication using access tokens.

auth_header property

auth_header: dict

Combined Domo + Jupyter headers (no guard — both tokens always present).

convert_auth classmethod

convert_auth(
    auth: DomoTokenAuth,
    jupyter_token: str,
    service_location: str,
    service_prefix: str,
) -> DomoJupyterTokenAuth

Create DomoJupyterTokenAuth from DomoTokenAuth + Jupyter params.

Source code in src/crew_dcs/auth/jupyter.py
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
@classmethod
def convert_auth(
    cls,
    auth: DomoTokenAuth,
    jupyter_token: str,
    service_location: str,
    service_prefix: str,
) -> "DomoJupyterTokenAuth":
    """Create DomoJupyterTokenAuth from DomoTokenAuth + Jupyter params."""
    return cls(
        domo_instance=auth.domo_instance,
        domo_access_token=auth.domo_access_token,
        jupyter_token=jupyter_token,
        service_location=service_location,
        service_prefix=service_prefix,
        token_name=auth.token_name,
        token=auth.token,
        user_id=auth.user_id,
        is_valid_token=auth.is_valid_token,
    )

get_auth_token async

get_auth_token(
    token_name: str | None = None, **context_kwargs
) -> str

Retrieve the access token, validating via who_am_i if needed.

Source code in src/crew_dcs/auth/jupyter.py
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
@log_call(
    level_name="auth",
    config=LogDecoratorConfig(
        entity_extractor=DomoEntityExtractor(),
        result_processor=DomoEntityResultProcessor(),
    ),
)
async def get_auth_token(
    self,
    token_name: str | None = None,
    **context_kwargs,
) -> str:
    """Retrieve the access token, validating via who_am_i if needed."""
    if not self.user_id:
        await self.who_am_i(**context_kwargs)
    self.token = self.domo_access_token
    self.is_valid_token = True
    if token_name:
        self.token_name = token_name
    return self.token