crew_dcs
crew_dcs ¶
crew_dcs — a Python SDK for the Domo platform APIs.
crew_dcs gives you programmatic access to the Domo platform: datasets,
cards, pages, dataflows, users, groups, AppDB, Code Engine, Jupyter
Workspaces, and more. It is built on httpx and is async at every I/O
boundary — API calls are async and return structured responses, never
raw httpx.Response objects.
The entry point: an auth object¶
Everything starts with an authentication object from crew_dcs.auth. Pick
the class that matches the credential you hold:
| Auth class | Credential | Typical use |
|---|---|---|
DomoTokenAuth |
Access token (Admin → Authentication → Access tokens) | Scripts, automation, service accounts |
DomoFullAuth |
Username + password | Interactive sessions |
DomoDeveloperAuth |
OAuth2 client ID + secret (developer.domo.com) | Public platform API surface |
DomoJupyterFullAuth / DomoJupyterTokenAuth |
Either of the above, inside Domo | Jupyter Workspaces |
Construct the auth once, then pass it as the first argument to any route function or entity class:
import asyncio
from crew_dcs.auth import DomoTokenAuth
from crew_dcs.routes.access_token import get_access_tokens
async def main() -> None:
auth = DomoTokenAuth(
domo_access_token="...",
domo_instance="mycompany", # mycompany.domo.com
)
res = await get_access_tokens(auth)
if res.is_success:
print(res.response)
asyncio.run(main())
Every auth class exposes await auth.who_am_i() — call it first to verify
credentials before doing real work.
How the library is built: the layers¶
crew_dcs.auth credentials in, auth headers + session pooling out
crew_dcs.routes one module per Domo API endpoint family — the HTTP boundary
crew_dcs.classes curated entity objects (DomoDataset, DomoCard, ...) built on routes
crew_dcs.client the request pipeline: get_data, looper, RouteContext, ResponseGetData
crew_dcs.base shared plumbing: entity registry + the exception hierarchy
Routes map to individual Domo APIs — one function per endpoint
operation, with minimal business logic. A route function builds the URL,
calls crew_dcs.client.get_data.get_data(), checks
ResponseGetData.is_success, raises a route-level exception on failure,
and returns the API payload essentially as Domo sent it. That thinness is
deliberate: what you read in Domo's API docs (or a browser network trace)
is what the route returns — no hidden transformation to debug.
Classes are the curated layer. crew_dcs.classes wraps the same routes
in friendlier entity objects — DomoDataset.from_dict(), collection
managers like DomoDatasets, access controllers, PDP helpers — so
application code reads like Domo concepts instead of HTTP calls. Entity
classes delegate to route modules for HTTP rather than calling get_data
themselves (the one exception is the dashboard_builder helper, which
predates a route wrapper for its endpoints).
What you can assume from any module¶
- Async at I/O boundaries only — anything that touches the network is
async; pure transforms stay sync. - Explicit auth on every call — no global client state or ambient
credentials; the
authobject carries the instance, token, and session pool. ResponseGetDataeverywhere — routes return the same dataclass:status,response(the parsed body),is_success, plusrequest_metadataandadditional_informationfor debugging.- Typed, per-module exceptions — failures raise subclasses of
crew_dcs.base.exceptions.RouteErrornamed after the module and HTTP method family, e.g.AccessToken_GET_Error,Jupyter_CRUD_Error. - Import from subpackages, not the package root — e.g.
from crew_dcs.auth import DomoTokenAuth. The root re-exports only__version__,entities, andexceptions. - Session reuse is on by default — one pooled
httpx.AsyncClientper auth object amortizes TCP/TLS handshakes across calls (opt out withRouteContext(reuse_session=False); response caching is separate and opt-in viacache_responses=True).
Debugging and logging¶
Every route and get_data call accepts a RouteContext (or equivalent
keyword arguments) with debugging knobs:
debug_api=True— print and log each request as it fires.dry_run=True— build the request and return it without sending; checkResponseGetData.is_dry_runbefore believing a write landed.return_raw=True— attach the rawhttpx.Responsefor inspection.
For structured colored logging, configure once at your entry point with
crew_dcs.utils.logging.set_domolibrary_logger(), and use the
is_log_client / is_log_route / is_log_class flags on RouteContext
to quiet individual layers.
Exceptions¶
All errors derive from crew_dcs.base.exceptions.DomoError, which carries
structured context (status, entity_id, domo_instance,
additional_context). RouteError additionally holds the failed
ResponseGetData as .res and pulls the human-readable message out of the
API payload for you. Catch the per-module subclass when you want to handle
one failure mode, or DomoError to catch everything the library raises.