{"id":896,"library":"looker-sdk","title":"Looker SDK for Python","description":"The `looker-sdk` is the official Python SDK for interacting with the Looker REST API. It provides a convenient, programmatic way to manage Looker instances, run queries, extract data, and automate workflows. Maintained by Google/Looker, it currently supports API 4.0 and requires Python 3.6+. It's actively developed with regular updates to support new Looker features and API versions.","status":"active","version":"26.6.1","language":"python","source_language":"en","source_url":"https://github.com/looker-open-source/sdk-codegen/tree/main/python","tags":["Looker","API","SDK","Business Intelligence","Analytics","Data Platform"],"install":[{"cmd":"pip install looker-sdk","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for HTTP transport layer.","package":"requests","optional":false},{"reason":"Used for structuring/unstructuring data, version restrictions may apply for older Python versions. Automatically installed with looker-sdk.","package":"cattrs","optional":false}],"imports":[{"symbol":"looker_sdk","correct":"import looker_sdk"},{"note":"API 3.1 and 3.0 were removed in Looker v23.18+. Always use init40() for current Looker instances.","wrong":"sdk = looker_sdk.init31()","symbol":"init40","correct":"sdk = looker_sdk.init40()"},{"note":"Provides access to Looker API models for creating or updating resources, e.g., models.WriteUser(). Alternatively, model-specific imports like from looker_sdk.models40 import WriteUser are also common.","symbol":"models","correct":"from looker_sdk import models"}],"quickstart":{"code":"import os\nimport looker_sdk\n\n# --- Configuration using Environment Variables ---\n# Set these environment variables before running:\n# LOOKERSDK_BASE_URL: Your Looker instance URL (e.g., https://your.looker.com or https://your.looker.cloud.google.com)\n#   Note: AWS-hosted instances may require ':19999' port (e.g., https://your.looker.com:19999), while GCP-hosted instances usually omit it.\n# LOOKERSDK_API_VERSION: Should be '4.0'\n# LOOKERSDK_VERIFY_SSL: 'true' or 'false'\n# LOOKERSDK_CLIENT_ID: Your API3 Client ID\n# LOOKERSDK_CLIENT_SECRET: Your API3 Client Secret\n# LOOKERSDK_TIMEOUT: (Optional) Request timeout in seconds, default is 120.\n\n# Example of setting environment variables (replace with your actual values):\nos.environ['LOOKERSDK_BASE_URL'] = os.environ.get('LOOKERSDK_BASE_URL', 'https://your.looker.com')\nos.environ['LOOKERSDK_API_VERSION'] = os.environ.get('LOOKERSDK_API_VERSION', '4.0')\nos.environ['LOOKERSDK_VERIFY_SSL'] = os.environ.get('LOOKERSDK_VERIFY_SSL', 'true')\nos.environ['LOOKERSDK_CLIENT_ID'] = os.environ.get('LOOKERSDK_CLIENT_ID', 'YOUR_CLIENT_ID')\nos.environ['LOOKERSDK_CLIENT_SECRET'] = os.environ.get('LOOKERSDK_CLIENT_SECRET', 'YOUR_CLIENT_SECRET')\n\n# Initialize the SDK for API 4.0\ntry:\n    sdk = looker_sdk.init40()\n    print(\"Looker SDK 4.0 initialized successfully.\")\n\n    # Make a simple API call to get the current user\n    me = sdk.me()\n    print(f\"Hello, {me.first_name} {me.last_name} ({me.email})!\")\n\n    # Example of creating a user (requires appropriate permissions)\n    # from looker_sdk import models\n    # new_user_data = models.WriteUser(first_name=\"Test\", last_name=\"User\", email=\"test.user@example.com\")\n    # new_user = sdk.create_user(body=new_user_data)\n    # print(f\"Created new user: {new_user.first_name}\")\n\nexcept Exception as e:\n    print(f\"Error initializing SDK or making API call: {e}\")\n    print(\"Please ensure environment variables (LOOKERSDK_BASE_URL, LOOKERSDK_API_VERSION, CLIENT_ID, CLIENT_SECRET) are correctly set.\")","lang":"python","description":"This quickstart demonstrates how to initialize the Looker SDK using environment variables (recommended for security) and make a basic API call to retrieve information about the current user. It highlights the use of `init40()` for API 4.0, which is the current stable version. Ensure you replace placeholder environment variables with your actual Looker instance details and API credentials."},"warnings":[{"fix":"Migrate your code to use Looker API 4.0 and initialize the SDK with `looker_sdk.init40()`. Update any API endpoint calls to their 4.0 equivalents.","message":"API 3.x (3.0 and 3.1) has been completely removed in Looker v23.18 (August 2023). Any applications or scripts using `looker_sdk.init31()` or directly calling 3.x API endpoints will fail.","severity":"breaking","affected_versions":"< 23.18"},{"fix":"Upgrade your `looker-sdk` to version 26.4 or later as soon as possible. Modify any custom scripts or applications that manually pass credentials in URL query parameters to pass them in the HTTP request body.","message":"Beginning with Looker 26.18 (expected October 2026), credentials for API login will *exclusively* be accepted in the HTTP request body. Passing credentials via URL query parameters will no longer be supported.","severity":"breaking","affected_versions":">= 26.18"},{"fix":"While `looker.ini` or environment variables are convenient for development, ensure `looker.ini` is never committed to source control (e.g., add to `.gitignore`). For production, implement a secure configuration retrieval method (e.g., using a secrets manager) by subclassing `api_settings.ApiSettings` and overriding `read_config` or using secure environment variable management.","message":"Storing API credentials directly in a `looker.ini` file or environment variables without proper security measures is a risk. For production environments, consider more secure storage solutions.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For AWS-hosted Looker, the `LOOKERSDK_BASE_URL` might require `:19999` (e.g., `https://your.looker.com:19999`). For GCP instances (e.g., `your.cloud.looker.com`), the port is typically omitted. Verify the correct base URL for your specific Looker instance.","message":"The base URL for your Looker instance can vary, especially between AWS and Google Cloud Platform (GCP) hosted instances, potentially requiring a port number.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Migrate to the official `looker-sdk` package (`pip install looker-sdk`) for all new and existing projects.","message":"The `lookerapi` Python package (installed via `pip install lookerapi-deprecated`) is an unofficial, unsupported SDK that was fully removed by the end of 2020. It will not receive updates and may not work with newer Python versions or Looker API changes.","severity":"deprecated","affected_versions":"<= 2020 (end-of-life)"}],"env_vars":null,"search_vec":"'3.6':49 '4.0':45 'activ':52 'analyt':70 'api':20,44,63,66 'autom':36 'busi':68 'conveni':24 'current':42 'data':34,71 'develop':53 'extract':33 'featur':61 'google/looker':40 'instanc':30 'intellig':69 'interact':15 'looker':1,7,18,29,60,65 'looker-sdk':6 'maintain':38 'manag':28 'new':59 'offici':11 'platform':72 'programmat':25 'provid':22 'python':4,12,48 'queri':32 'regular':55 'requir':47 'rest':19 'run':31 'sdk':2,8,13,67 'support':43,58 'updat':56 'version':64 'way':26 'workflow':37","created_at":"2026-03-29T06:06:41.565512+00:00","updated_at":"2026-04-16T16:22:18.858472+00:00","problems":[{"fix":"Install the Looker SDK using pip: `pip install looker-sdk`","cause":"The `looker-sdk` Python package is not installed in your current environment or your environment's Python path is not correctly configured.","error":"ModuleNotFoundError: No module named 'looker-sdk'"},{"fix":"Try uninstalling and reinstalling the package: `pip uninstall looker-sdk && pip install looker-sdk`.","cause":"This usually indicates an issue with the `looker-sdk` installation, where the `rtl` (runtime library) submodule cannot be found, possibly due to an incomplete installation or a specific version conflict.","error":"ModuleNotFoundError: No module named 'looker_sdk.rtl'"},{"fix":"Verify the API endpoint URL in your `looker.ini` or SDK configuration, ensure the resource ID/path is correct, and confirm that the API credentials have the required permissions for the requested operation. Also, ensure you are using the correct API version (e.g., `init40()` for API 4.0).","cause":"This error typically occurs when the requested resource (e.g., dashboard, Look, user) does not exist, the API endpoint URL is incorrect (e.g., wrong port or base URL), or the authenticated user lacks the necessary permissions to access that resource.","error":"SDKError: Looker Not Found (404)"},{"fix":"Check your `looker.ini` file or environment variables (`LOOKERSDK_CLIENT_ID`, `LOOKERSDK_CLIENT_SECRET`, `LOOKERSDK_BASE_URL`) to ensure your API credentials are correct and unexpired. Verify that the associated Looker user has the necessary roles and permissions.","cause":"Authentication failed because of invalid or expired API credentials (client ID/secret), the API key lacking sufficient permissions, or the authentication token not being passed correctly in the HTTP request.","error":"Unauthorized (401)"},{"fix":"Remove the explicit import of `client`. Initialize the SDK client directly, for example: `sdk = looker_sdk.init40()`.","cause":"In newer versions of the `looker-sdk`, the `client` module is not directly exposed for import. The SDK client is initialized directly via functions like `looker_sdk.init40()`.","error":"ImportError: cannot import name 'client' from 'looker_sdk'"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"26.12.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://pypi.python.org/pypi/looker_sdk","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/looker-sdk/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["crm-productivity","http-networking","gcp"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":"verified"}}