Monte Carlo Python Client

0.163.0 · active · verified Thu Apr 16

The `montecarlodata` library provides a Python client for interacting with the Monte Carlo data observability platform. It allows users to programmatically manage metadata, incidents, and other aspects of their data environment. As of version 0.163.0, it offers a robust API wrapper. The library sees frequent updates, often multiple minor releases per week, indicating active development and continuous improvements.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart initializes the Monte Carlo client using API keys sourced from environment variables. It includes a basic check for missing credentials and demonstrates how to instantiate the `MonteCarloClient` to prepare for API interactions. Actual API calls are commented out as they require valid credentials and a configured Monte Carlo environment.

import os
from montecarlodata.client import MonteCarloClient

# It is highly recommended to store API keys securely in environment variables.
# Example: export MONTE_CARLO_API_KEY="your_key"
api_key = os.environ.get("MONTE_CARLO_API_KEY", "")
api_secret = os.environ.get("MONTE_CARLO_API_SECRET", "")

if not api_key or not api_secret:
    print("Warning: MONTE_CARLO_API_KEY and MONTE_CARLO_API_SECRET environment variables are not set.")
    print("Client initialization may fail without valid credentials.")
    # For a runnable quickstart, we proceed, but real applications would raise an error.

try:
    client = MonteCarloClient(api_key=api_key, api_secret=api_secret)
    print("MonteCarloClient initialized successfully (credentials may be invalid).")

    # Example: Attempt to list some catalogs. This will likely fail with invalid/missing keys.
    # This demonstrates an API call but requires proper authentication and data setup.
    # catalog_info = client.metadata.list_catalogs()
    # print(f"Successfully fetched {len(catalog_info.items)} catalog entries.")

except Exception as e:
    print(f"Error initializing MonteCarloClient or making an API call: {e}")
    print("Please ensure your MONTE_CARLO_API_KEY and MONTE_CARLO_API_SECRET are correctly set.")

view raw JSON →