Skip to main content

Looker API 3.1

Project description

The Looker SDK for Python provides a convenient and strongly typed way to communicate with the Looker API available on your Looker server. The library supports python versions 3.6, 3.7, and 3.8.

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
# and away you go
my_user = sdk.me()
new_user = looker_sdk.models.WriteUser(first_name="Jane", last_name="Doe")
sdk.create_user(body=new_user)

sample project setup

Install python: we’ll use 3.8 for this tutorial. 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 https://github.com/pyenv/pyenv#basic-github-checkout 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 <https://github.com/looker-open-source/sdk-codegen#environment-variable-configuration> (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:

[Looker]
# Base URL for API. Do not include /api/* in the url
base_url=https://self-signed.looker.com:19999
# API 3 client id
client_id=YourClientID
# API 3 client secret
client_secret=YourClientSecret
# Set to false if testing locally against self-signed certs. Otherwise leave True
verify_ssl=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

Code example

See many python sdk examples in our examples repo

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

looker_sdk-0.1.3b14.tar.gz (240.3 kB view details)

Uploaded Source

Built Distribution

looker_sdk-0.1.3b14-py3-none-any.whl (263.8 kB view details)

Uploaded Python 3

File details

Details for the file looker_sdk-0.1.3b14.tar.gz.

File metadata

  • Download URL: looker_sdk-0.1.3b14.tar.gz
  • Upload date:
  • Size: 240.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for looker_sdk-0.1.3b14.tar.gz
Algorithm Hash digest
SHA256 d051f93f1feef9dc510dc52b26d66439ae11ccc188d04c46046e501999cf43dd
MD5 81af84901cc0b2f418328355c8a28f80
BLAKE2b-256 71e779a1c10f62960bb5c2280503f96dcc7dd7524375a3c0179a7b2f2fb14006

See more details on using hashes here.

Provenance

File details

Details for the file looker_sdk-0.1.3b14-py3-none-any.whl.

File metadata

  • Download URL: looker_sdk-0.1.3b14-py3-none-any.whl
  • Upload date:
  • Size: 263.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for looker_sdk-0.1.3b14-py3-none-any.whl
Algorithm Hash digest
SHA256 7da19dab88d258d22d8c18d0b7ae675f20a65225913cb6a929acce76615eca54
MD5 194b8b65f8410f9ceb8fe994f22ef94d
BLAKE2b-256 3421089eb2a67822c7fb28c1b3afa7ddc213a6b8dbd8dfcc059d65bfc066f1f3

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page