pylooker icon indicating copy to clipboard operation
pylooker copied to clipboard

KeyError

Open Lathesh-B-L opened this issue 7 years ago • 1 comments

Hi David,

Here is the sample code, which I am trying to run the query, can you please suggest how to resolve the KeyError

import pandas as pd
import json
from pylooker.client import LookerClient

api_endpoint = 'https://<my-looker-endpoint>:19999/api/3.1/'
client_id = '<my-looker-client_id>'
client_secret = '<my-looker-client_secret>'
lc = LookerClient(api_endpoint, client_id, client_secret)
query_data = lc.run_query('<my-looker-Query_ID>')
print(type(query_data))
KeyError                                  Traceback (most recent call last)
<ipython-input-22-9041a9264702> in <module>()
     
---> 14 query_data = lc.run_query('<my-looker-Query_ID>')
     15 print(type(query_data))
     16 #df = pd.DataFrame(look_data)

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pylooker\client.py in run_query(self, slug, format, limit)
    118             url="{}{}/run/{}?limit={}".format(
    119                 self.api_endpoint + "queries/",
--> 120                 slug_response.json()["id"],
    121                 format,
    122                 limit,

KeyError: 'id'

Lathesh-B-L avatar Sep 04 '18 13:09 Lathesh-B-L

Hey there @Lathesh-B-L!

Would you mind trying with the 3.0 API endpoint (https://looker.company.com:19999/api/3.0/)?

davidgasquez avatar Sep 04 '18 14:09 davidgasquez