DomoJupyter Integration

auth = dmda.DomoTokenAuth(
    domo_instance=os.environ["DOMO_DOJO_INSTANCE"],
    domo_access_token=os.environ["DOMO_DOJO_ACCESS_TOKEN"],
)

JUPYTER_TOKEN = " OT98Xy8sePH894pA7SgUhjEcjk1kHK"
WORKSPACE_ID = '1cfe9db4-5937-4889-beb3-a311fc42f246' #learn_jupyter

workspace_params = await get_workspace_auth_token_params(
    workspace_id=WORKSPACE_ID, auth=auth
)

dj_auth = dmda.DomoJupyterTokenAuth.convert_auth(
    auth=auth, jupyter_token=JUPYTER_TOKEN, **workspace_params
)

![Tutorial Video pt 4 of 4]

DomoJupyter Content and Class


source

DomoJupyter_Content

 DomoJupyter_Content (name:str, folder:str,
                      last_modified:datetime.datetime, file_type:str,
                      content:str,
                      auth:domolibrary.client.DomoAuth.DomoJupyterAuth,
                      default_export_folder:str='export')
try:
    await DomoJupyter_Content.create_content(
        auth=dj_auth,
        new_content="hello world",
        folder_path="./admin/song/help6.txt",
        debug_api=False,
    )

except dmde.DomoError as e:
    print(e)
🛑  JupyterAPI_Error 🛑 - function: DomoJupyter_Content.get_traceback || status 409 || conlict during PATCH - does the content already exist? at domo-community
@patch_to(DomoJupyter_Content)
async def delete(
    self,
    debug_api: bool = False,
    session: httpx.AsyncClient = None,
    debug_num_stacks: int = 2,
):
    return await jupyter_routes.delete_jupyter_content(
        auth=self.auth,
        content_path=f"{self.folder}/{self.name}",
        debug_api=debug_api,
        debug_num_stacks=debug_num_stacks,
        parent_class=self.__class__.__name,
        session=session,
    )