Hi,
For looker automation, I need to write python script for looker API. I am able to authenticate looker api using client id and password and base_url. My question is: How and where in the script can I add get request containing different url than base_url for validation.
My script:
import lookerapi as looker
# replace with your custom Looker API Host domain and port, if applicable.
base_url = 'https://insights-ms-dev.hpcloud.hp.com:19999/api/3.1/'
#Looker admins can create API3 credentials on Looker's **Admin/Users** page
client_id = ' '
client_secret = ‘ '
# instantiate Auth API
unauthenticated_client = looker.ApiClient(base_url)
unauthenticated_authApi = looker.ApiAuthApi(unauthenticated_client)
# authenticate client
token = unauthenticated_authApi.login(client_id=client_id, client_secret=client_secret)
client = looker.ApiClient(base_url, 'Authorization', 'token ' + token.access_token)
# instantiate User API client
userApi = looker.UserApi(client)
me = userApi.me();
print(me)
# instantiate Look API client
queryAPI = looker.QueryApi(client)
body = {
"model":"bird_mps_insights",
"view":"customer",
"fields":"",
"query_timezone":"America/Los_Angeles"
}
resp = queryAPI.run_inline_query("json",body)
print(resp)
In the above code, where can I add GET request “https://insights-ms-dev.hpcloud.hp.com:19999/api/3.1/dashboards/9” for getting all dashboards.
Best answer by Eric_Lyons
View original