A basic Python interface to Looker API.
You can use pip
to install PyLooker.
pip install pylooker
If you prefer, you can clone it and run the setup.py file. Use the following commands to install PyLooker from Github:
git clone https://github.com/bufferapp/pylooker
cd pylooker
python setup.py install
To use PyLooker you'll need to get the client_id
and client_secret
pair for
your Looker user. You can request these to your Looker admin as stated in the
Looker documentation.
from pylooker.client import LookerClient
api_endpoint = 'https://looker.company.com:19999/api/3.0/'
client_id = 'your-client-id'
client_secret = 'your-client-secret'
lc = LookerClient(api_endpoint, client_id, client_secret)
look_data = lc.run_look(1234)
query_data = lc.run_query('5A0lg9e7U7SNN8fquk0JKz')
The JSON results can be converted to a Pandas Dataframe:
import pandas as pd
df = pd.DataFrame(query_data)