Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.

Commit 150f5ea

Browse files
committed
Example simple schedule function
1 parent 486a4f6 commit 150f5ea

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

python/simple_schedule_example.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from looker_sdk import methods, models40
2+
import looker_sdk
3+
import exceptions
4+
sdk = looker_sdk.init40("../looker.ini")
5+
6+
7+
def create_simple_schedule(dashboard_id:int,user_id:int,schedule_title:str, format:str, email:str,type:str, message:str, crontab:str):
8+
### For more information on the Params accepted https://github.com/looker-open-source/sdk-codegen/blob/master/python/looker_sdk/sdk/api31/methods.py#L2144
9+
### And for schedule destination go: https://github.com/looker-open-source/sdk-codegen/blob/master/python/looker_sdk/sdk/api31/models.py#L4601
10+
### Supported formats vary by destination, but include: "txt", "csv", "inline_json", "json", "json_detail", "xlsx", "html", "wysiwyg_pdf", "assembled_pdf", "wysiwyg_png"
11+
### type: Type of the address ('email', 'webhook', 's3', or 'sftp')
12+
schedule = sdk.create_scheduled_plan(
13+
body=models40.WriteScheduledPlan(name=schedule_title, dashboard_id=dashboard_id, user_id=user_id, run_as_recipient= True, crontab=crontab, scheduled_plan_destination = [models40.ScheduledPlanDestination(format=format, apply_formatting=True, apply_vis=True, address=email, type=type, message=message)]))
14+
create_simple_schedule(1234,453,"This is an automated test", "assembled_pdf", "test@looker.com", "email", "Hi Looker User!", "0 1 * * *")
15+
16+

0 commit comments

Comments
 (0)