v.0.16
2023.02.14
pip install --upgrade shimoku-api-pythonFixes
Improvements
s = Shimoku.Client( access_token=api_key, universe_id=universe_id, environment=environment, verbosity=verbose, async_execution=async_execution, business_id=business_id, ) menu_path = 'test_activity' activity_name = 'test_activity' # To create an activity the location and the activity name is needed, # the returned value is a dictionary activity = s.activity.create_activity(menu_path, activity_name) # To create a run just pass the location, the activity name and its settings # the returned value is a dictionary settings = {'Test': 'settings', 'Settings': 'test'} run = s.activity.create_run(menu_path, activity_name, settings) # When creating a run you can copy the settings of another run by passing the id run_1 = s.activity.create_run(menu_path, activity_name, settings=run['id']) # For the creation a log you have to provide the path, the activity, the run id # and the information that you want to store. # the severity parameter can only have so many values (['INFO', 'DEBUG', 'ERROR', 'CRITICAL']) log = s.activity.create_run_log(menu_path, activity_name, run_id=run['id'], message='test message', severity='INFO', tags=['tag1', 'tag2', 'tag3']) # to retrieve an activity that already exists use the method get_activity, passing # the same parameters as for create_activity # you can specify how many runs to get, by default it will retrieve one run activity = s.activity.get_activity(menu_path, activity_name, how_many_runs=2) # the runs are returned by ascending order of their last log [run_1, run] = activity['runs'] # this way you can retrieve the logs of a run logs = run['logs'] # This way you can delete an activity s.activity.delete_activity(menu_path, activity_name)# The function execute activity creates a run and then executes the run # the return value is the dictionary of the run run = s.activity.execute_activity(menu_path, activity_name, settings) # You can pass settings the same way as when creating a run run_1 = s.activity.execute_activity(menu_path, activity_name, settings=run['id']) # Another way of executing a run is with it's id run_2 = s.activity.create_run(menu_path, activity_name, settings=run['id']) s.activity.execute_run(menu_path, activity_name, run_id=run['id']s.activity.button_execute_activity( menu_path=menu_path, activity_name=activity_name, order=0, label='test_button', cols_size=12, align='start' ) s.activity.button_execute_activity( menu_path=menu_path, activity_name=activity_name, order=1, label='test_button', cols_size=12, align='center' ) s.activity.button_execute_activity( menu_path=menu_path, activity_name=activity_name, order=2, label='test_button',rows_size=2, cols_size=12, align='right' ) for i in range(6): s.activity.button_execute_activity( menu_path=menu_path, activity_name=activity_name, order=3+i, label='test_button', rows_size=2, cols_size=12-i*2, align='stretch', padding=f'0,{i},0,{i}' ) s.activity.button_execute_activity( menu_path=menu_path, activity_name=activity_name, order=9, label='test_button', cols_size=12, align='center' )
Different button sizes and positions
Last updated
Was this helpful?