Skip to main content

Looker API 3.1

Project description

The Looker SDK for Python provides a convenient way to communicate with the Looker API available on your Looker server. The library requires python3.6+ and is annotated using the typing module.

DISCLAIMER: This is a beta version of the Looker SDK, using a completely new code generator developed by Looker. Implementations are still subject to change, but we expect most SDK method calls to work correctly. If you run into problems with the SDK, please feel free to report an issue, and please indicate which language SDK you’re using in the report.

Basic Usage

import looker_sdk

sdk = looker_sdk.init31()  # or init40() for v4.0 API
my_user =

# output can be treated like a dictionary
# or a model instance (User in this case)

# input methods can take either model instances like WriteUser
    body=looker_sdk.models.WriteUser(first_name="Jane", last_name="Doe")
# or plain dictionaries
sdk.create_user(body={"first_name": "Jane", last_name: "Doe"})

sample project setup

Install python 3.8. We highly recommend using pyenv to install different versions of python. Mac users should use homebrew to install pyenv:

brew install pyenv

Follow the remaining steps 3 - 5 of otherwise your python3.8 installation may break.

Now you’re ready to install python 3.8:

pyenv install 3.8.2

We’ll use pipenv (fantastic virtualenv manager) to manage project dependencies.

brew install pipenv

Create a project directory

mkdir looker-sdk-example

Set python3.8 as the base interpreter for this directory

cd looker-sdk-example/
pyenv local 3.8.2

Install looker_sdk using pipenv

pipenv --python 3.8.2 install --pre looker_sdk

Configuring the SDK

The SDK supports configuration through a .ini file on disk as well as setting environment variables <> (the latter override the former).

Note: The .ini configuration for the Looker SDK is a sample implementation intended to speed up the initial development of python applications using the Looker API. See this note on Securing your SDK Credentials for warnings about using .ini files that contain your API credentials in a source code repository or production environment.

In order to configure the SDK client, create a “looker.ini” file to reference during client.setup()

example file:

# Base URL for API. Do not include /api/* in the url
# API 3 client id
# API 3 client secret
# Set to false if testing locally against self-signed certs. Otherwise leave True

Note: If the application using the Looker SDK is going to be committed to a version control system, be sure to ignore the looker.ini file so the API credentials aren’t unintentionally published.

For any .ini setting you can use an environment variable instead. It takes the form of LOOKERSDK_<UPPERCASE-SETTING-FROM-INI> e.g. LOOKERSDK_CLIENT_SECRET

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for looker-sdk, version 7.20.0
Filename, size File type Python version Upload date Hashes
Filename, size looker_sdk-7.20.0-py3-none-any.whl (311.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size looker_sdk-7.20.0.tar.gz (290.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page