Domo Python SDK

0.3.0.16 · active · verified Tue Apr 14

pydomo is the official Python SDK for interacting with the Domo API. It provides a convenient way to manage Domo datasets, users, groups, and more, streamlining data integration and automation workflows. The current version is 0.3.0.16, with an active but irregular release cadence focusing on bug fixes, feature parity with the R SDK, and API improvements.

Warnings

Install

Imports

Quickstart

Initializes the Domo client and demonstrates how to list the first 10 datasets in your Domo instance. Ensure `DOMO_CLIENT_ID` and `DOMO_CLIENT_SECRET` environment variables are set.

import os
from pydomo import Domo
from pydomo.exceptions import DomoAPIException

# Available from environment variables or a config file
CLIENT_ID = os.environ.get('DOMO_CLIENT_ID', 'your_client_id')
CLIENT_SECRET = os.environ.get('DOMO_CLIENT_SECRET', 'your_client_secret')
API_HOST = os.environ.get('DOMO_API_HOST', 'api.domo.com') # can be overridden for sandbox etc.

if not CLIENT_ID or not CLIENT_SECRET:
    print("Error: DOMO_CLIENT_ID and DOMO_CLIENT_SECRET environment variables must be set.")
    exit(1)

do = Domo(CLIENT_ID, CLIENT_SECRET, api_host=API_HOST)

try:
    # Example: List up to 10 datasets
    datasets = do.datasets
    list_of_datasets = datasets.list(limit=10)
    if list_of_datasets:
        print(f"Found {len(list_of_datasets)} datasets:")
        for ds in list_of_datasets:
            print(f"  ID: {ds['id']}, Name: {ds['name']}")
    else:
        print("No datasets found.")

except DomoAPIException as e:
    print(f"Domo API Error: {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →