Set API Credentials for Your Look Instance
creds = {
'api_endpoint' : 'https://my_org.looker.com:19999/api/3.0',
'login_url': 'https://my_org.looker.com:19999/login',
'client_id' : 'secret',
'client_secret': 'secret'
}
demo = LookerAPI(creds)
Login to Instance - Return token to be used in subsequent calls.
json_auth = demo.login()
print('access_token: ' + json_auth)
`https://my_org.looker.com:19999/login
JSONDecodeError Traceback (most recent call last)
/var/folders/ft/s3sdj8k95pl163zp1471x_g40000gn/T/ipykernel_24838/1138058121.py in
12
13 # Login to Instance - Return token to be used in subsequent calls.
---> 14 json_auth = demo.login()
15
16 print('test2')
/var/folders/ft/s3sdj8k95pl163zp1471x_g40000gn/T/ipykernel_24838/3181836974.py in login(self)
13 auth_data = {'client_id':self.client_id, 'client_secret':self.client_secret}
14 r = requests.post( self.login_endpoint,data=auth_data) # error handle here
---> 15 json_auth = json.loads(r.text)['access_token']
16 return json_auth
17 except requests.exceptions.RequestException as e:
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/init.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:
348 cls = JSONDecoder
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py in decode(self, s, _w)
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
`