Skip to content

How crew-dcs is organised

crew-dcs has three layers you will use. You build credentials with crew_dcs.auth. You call Domo with crew_dcs.routes. You work with Domo objects through crew_dcs.classes. Start with routes. Move to classes when you want an object that knows how to do things.

The same task, two ways

The task: fetch one DataSet by its id and print its name. Both scripts need the .env file from Authenticating to Domo.

With a route

import asyncio
import os

from dotenv import load_dotenv

from crew_dcs.auth import DomoTokenAuth
from crew_dcs.routes import dataset as dataset_routes

load_dotenv()


async def main():
    async with DomoTokenAuth(
        domo_instance=os.environ["DOMO_INSTANCE"],
        domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
    ) as auth:
        res = await dataset_routes.get_dataset_by_id(
            dataset_id=os.environ["DOMO_DATASET_ID"], auth=auth
        )
        print(res.response["name"])


asyncio.run(main())

The route returns a response object. What Domo sent back is in res.response, here a dictionary, so you read the name with res.response["name"].

With a class

import asyncio
import os

from dotenv import load_dotenv

from crew_dcs.auth import DomoTokenAuth
from crew_dcs.classes.DomoDataset import DomoDataset

load_dotenv()


async def main():
    async with DomoTokenAuth(
        domo_instance=os.environ["DOMO_INSTANCE"],
        domo_access_token=os.environ["DOMO_ACCESS_TOKEN"],
    ) as auth:
        dataset = await DomoDataset.get_by_id(
            auth=auth, dataset_id=os.environ["DOMO_DATASET_ID"]
        )
        print(dataset.name, "-", dataset.row_count, "rows")


asyncio.run(main())

The class gives you a DomoDataset object. Its details are attributes (dataset.name, dataset.row_count, dataset.id), not dictionary keys. Under the hood, get_by_id calls the route for you.

Add DOMO_DATASET_ID=<a DataSet id from your Domo> to your .env to run either one.

Routes: one function per Domo API call

crew_dcs.routes holds one Python function for each Domo API call. A call is one URL on your Domo instance. The functions are grouped in modules by topic: crew_dcs.routes.dataset, crew_dcs.routes.user, crew_dcs.routes.card and so on.

A route:

  • takes auth and the ids it needs, such as dataset_id
  • makes one request to Domo
  • returns a response object, or raises an error if Domo said no (see Errors)

The response object has three things you will use:

Attribute What it holds
.response What Domo sent back. A dictionary, a list, or text, depending on the route.
.status The HTTP status number, such as 200 or 404.
.is_success True when Domo answered with a success status.

Routes do almost nothing to the answer. What Domo returns is what you get. That makes them easy to compare with Domo's own API documentation or with what you see in your browser's network tab.

Classes: Domo objects built on routes

crew_dcs.classes holds one class for each kind of Domo object: DomoDataset, DomoUser, DomoGroup, DomoCard, DomoPage and more. A class calls routes for you and keeps the answer on the object.

  • get_by_id fetches one object by its id. Many classes have it.
  • Some classes also have a plural partner for lists, such as DomoDatasets.
  • An object can have helpers of its own. A DomoDataset carries parts such as its schema and its tags, so you ask the object instead of finding the right route.

Auth: who you are

crew_dcs.auth holds the credential objects. DomoTokenAuth is the one most scripts use. You make one and pass it to every route and every class. There is no global login. The auth object is how each call knows your Domo instance and who you are. See Authenticating to Domo for the others.

How async works

Every Domo call in crew-dcs is async. Python can start a slow job, such as a call over the network, and do other work while it waits. A function that works this way is declared with async def. Three pieces make it run:

  • async def main(): declares a function that can wait.
  • await goes in front of a call that talks to Domo. It means "wait here for the answer". You can only use await inside an async def function.
  • asyncio.run(main()) starts the function from normal code. asyncio is part of Python, so you install nothing.

In a Jupyter notebook you can skip asyncio.run and write await directly in a cell.

When to pick a route or a class

You want to... Use
Make one call and read the raw answer A route
Do something Domo has an endpoint for, and only that A route
Work with one DataSet, user or card and its parts A class
Have the object keep its own details for later A class
Hand a script to an AI agent Routes first, because each does one visible thing

If you are not sure, start with a route. You can move to a class later without changing your auth.

A map of the main subpackages

Package What is in it
crew_dcs.auth Credential objects such as DomoTokenAuth.
crew_dcs.routes One function per Domo API call, grouped by topic.
crew_dcs.classes Objects for Domo things, built on routes.
crew_dcs.integrations Longer jobs that combine several routes and classes.
crew_dcs.models Plain data shapes for what Domo sends back.
crew_dcs.client The shared engine every route uses to send the request. You rarely call it.
crew_dcs.base The error classes. See Errors.
crew_dcs.utils Small helpers.
crew_dcs.mcp_server An optional server that lets AI tools call crew-dcs.

Browse the full list in the reference: crew_dcs.routes, crew_dcs.classes and crew_dcs.auth.

Next

  • Errors: what goes wrong, and how to catch it.
  • Glossary: the Domo and crew-dcs terms used on this site.

Stuck?

Upgrade crew-dcs to the latest version first, because bugs are fixed often. If it still fails, ask in the DataCrew community Slack: datacrew.space/slack.