{"id":9128,"library":"montecarlodata","title":"Monte Carlo Python Client","description":"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.","status":"active","version":"0.163.0","language":"en","source_language":"en","source_url":"https://github.com/montecarlodata/montecarlodata-python","tags":["data-observability","api-client","cli","data-management"],"install":[{"cmd":"pip install montecarlodata","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The main client class `MonteCarloClient` resides within the `client` submodule, not directly under the top-level `montecarlodata` package.","wrong":"from montecarlodata import MonteCarloClient","symbol":"MonteCarloClient","correct":"from montecarlodata.client import MonteCarloClient"}],"quickstart":{"code":"import os\nfrom montecarlodata.client import MonteCarloClient\n\n# It is highly recommended to store API keys securely in environment variables.\n# Example: export MONTE_CARLO_API_KEY=\"your_key\"\napi_key = os.environ.get(\"MONTE_CARLO_API_KEY\", \"\")\napi_secret = os.environ.get(\"MONTE_CARLO_API_SECRET\", \"\")\n\nif not api_key or not api_secret:\n    print(\"Warning: MONTE_CARLO_API_KEY and MONTE_CARLO_API_SECRET environment variables are not set.\")\n    print(\"Client initialization may fail without valid credentials.\")\n    # For a runnable quickstart, we proceed, but real applications would raise an error.\n\ntry:\n    client = MonteCarloClient(api_key=api_key, api_secret=api_secret)\n    print(\"MonteCarloClient initialized successfully (credentials may be invalid).\")\n\n    # Example: Attempt to list some catalogs. This will likely fail with invalid/missing keys.\n    # This demonstrates an API call but requires proper authentication and data setup.\n    # catalog_info = client.metadata.list_catalogs()\n    # print(f\"Successfully fetched {len(catalog_info.items)} catalog entries.\")\n\nexcept Exception as e:\n    print(f\"Error initializing MonteCarloClient or making an API call: {e}\")\n    print(\"Please ensure your MONTE_CARLO_API_KEY and MONTE_CARLO_API_SECRET are correctly set.\")\n","lang":"python","description":"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."},"warnings":[{"fix":"Ensure you are passing `api_key` and `api_secret` directly as keyword arguments to `MonteCarloClient(api_key=..., api_secret=...)`.","message":"The client initialization method underwent significant changes around version `0.117.0`. Older versions might have used different parameter names or relied on implicit environment variables without direct passing. The current method requires `api_key` and `api_secret` to be passed explicitly to the `MonteCarloClient` constructor.","severity":"breaking","affected_versions":"<0.117.0"},{"fix":"Verify that your Monte Carlo API key and secret are correctly set in your environment variables or passed directly to the client, and that they have the necessary permissions for the operations you are performing. Refer to Monte Carlo documentation for key generation.","message":"Incorrect or missing API keys (`MONTE_CARLO_API_KEY`, `MONTE_CARLO_API_SECRET`) will prevent the client from authenticating and making successful API calls, leading to authentication errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change your import statement from `from montecarlodata import MonteCarloClient` to `from montecarlodata.client import MonteCarloClient`.","cause":"Attempting to import `MonteCarloClient` directly from the `montecarlodata` package instead of its `client` submodule.","error":"AttributeError: module 'montecarlodata' has no attribute 'MonteCarloClient'"},{"fix":"Double-check your `MONTE_CARLO_API_KEY` and `MONTE_CARLO_API_SECRET` environment variables or the values passed directly to the client. Ensure they are valid and active within your Monte Carlo account.","cause":"The API key or secret provided to the `MonteCarloClient` is either missing, incorrect, or expired.","error":"montecarlodata.errors.AuthenticationError: Invalid credentials provided"}]}