Hello,
I am new using looker_sdk and do not find a running sample.
That can run a schedule plan once.
Use looker_sdk, api 3.1, genereated API key for test user.
I simple tried this ( indenting maybe not correct cause of copy);
from looker_sdk import client, models, error
import requests
import requests.auth
if __name__ == "__main__":
print("Start")
scheduled_plan_id = 132
sdk = client.setup("looker.ini")
looker_api_user = sdk.me()
sdk.login_user(looker_api_user.id)
try:
# result = sdk.scheduled_plan_run_once_by_id(scheduled_plan_id)
print(sdk.auth.user_token.token_type)
header = {
"access_token": sdk.auth.user_token.access_token,
"token_type": sdk.auth.user_token.token_type,
"expires_in": str(sdk.auth.user_token.expires_in)
}
print(header)
looker_request = "https://springmedia.de.looker.com:19999/api/3.1/scheduled_plans/" + str(scheduled_plan_id) \
+ "/run_once"
print(looker_request)
response = requests.post(looker_request, headers=header)
print(response)
sdk.logout()
except Exception as e:
sdk.logout()
print(str(e))
sdk.logout()
Result is always:
{‘access_token’: ‘xxxxxxxxxxxxxxxxxxxxxxx’, ‘token_type’: ‘Bearer’, ‘expires_in’: ‘3600’}
https://xxxxxxx.de.looker.com:19999/api/3.1/scheduled_plans/16/run_once
<Response [401]>
Would be simple use at one point
the method sdk.scheduled_plan_run_once_by_id(scheduled_plan_id)
but also do not function.
I would be appreciate for help 🙂
Sample code yould be nice, or what is wrong