= dmda.DomoTokenAuth(
token_auth =os.environ['DOMO_INSTANCE'],
domo_instance=os.environ["DOMO_ACCESS_TOKEN"],
domo_access_token
)
= 384424178 page_id
Page
DomoPage
DomoPage
DomoPage (id:int, title:str=None, top_page_id:int=None, parent_page_id:int=None, auth:domolibrary.client.DomoAuth.DomoAuth=None, is_locked:bool=None, collections:list=<factory>, owners:list=<factory>, cards:list=<factory>, custom_attributes:dict=<factory>, layout:domolibrary.classes.Do moPage_Content.PageLayout=<factory>, domo_cards:List[Any]=None, domo_datasets:List[Any]=None, Lineage:domolibrary.classes.DomoLineage.DomoLineage=None)
Domo Pages
DomoPages
DomoPages (auth:domolibrary.client.DomoAuth.DomoAuth, pages:List[__main__.DomoPage]=None)
sample implementation of get_pages
= DomoPages(auth = token_auth)
dmic_pages await dmic_pages.get())[0:5] (
[DomoPage(id=1613954604, title='_-ST Superman-_', top_page_id=None, parent_page_id=1008358638, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None),
DomoPage(id=124947681, title='1nw', top_page_id=None, parent_page_id=None, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None),
DomoPage(id=1316566624, title='20210623_TRAINING_DomoStats Activity Log App', top_page_id=522373865, parent_page_id=127044793, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None),
DomoPage(id=377152481, title='2023 Bowl Games', top_page_id=None, parent_page_id=1148061566, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None),
DomoPage(id=1630657884, title='2023-10-24 Success Strategy - New', top_page_id=None, parent_page_id=None, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None)]
= await DomoPages.get_pages(auth=token_auth, return_raw=False)
domo_pages 0:5] domo_pages[
[DomoPage(id=1613954604, title='_-ST Superman-_', top_page_id=None, parent_page_id=1008358638, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None),
DomoPage(id=124947681, title='1nw', top_page_id=None, parent_page_id=None, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None),
DomoPage(id=1316566624, title='20210623_TRAINING_DomoStats Activity Log App', top_page_id=522373865, parent_page_id=127044793, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None),
DomoPage(id=377152481, title='2023 Bowl Games', top_page_id=None, parent_page_id=1148061566, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None),
DomoPage(id=1630657884, title='2023-10-24 Success Strategy - New', top_page_id=None, parent_page_id=None, is_locked=False, collections=None, owners=[], cards=[], custom_attributes={}, layout={}, domo_cards=None, domo_datasets=None)]
DomoPage Cont
get_by_id
DomoPage.get_by_id
DomoPage.get_by_id (page_id:str, auth:domolibrary.client.DomoAuth.DomoAuth, return_raw:bool=False, debug_api:bool=False, include_layout:bool=False, include_recursive_children:bool=True, include_recursive_parents:bool=False, debug_num_stacks_to_drop=2, session:httpx.AsyncClient=None, id=None)
Type | Default | Details | |
---|---|---|---|
page_id | str | ||
auth | DomoAuth | ||
return_raw | bool | False | |
debug_api | bool | False | |
include_layout | bool | False | |
include_recursive_children | bool | True | if True, will drill down to all the Children. Set to False to prevent calculating children |
include_recursive_parents | bool | False | |
debug_num_stacks_to_drop | int | 2 | |
session | AsyncClient | None | |
id | NoneType | None |
sample implementations of get_by_id
retrieve page without get_children_recursion
try:
await DomoPage.get_by_id(
=page_id,
page_id=token_auth,
auth=False,
return_raw=True,
include_layout=False,
include_recursive_children
)
except PageRetrieval_byId_Error as e:
print(e)
with parent_page and top_page
try:
= await DomoPage.get_by_id(
domo_page =30507758,
page_id=token_auth,
auth=False,
return_raw=True,
include_layout=True,
include_recursive_parents=False,
include_recursive_children
)
print(domo_page.custom_attributes["top_page"])
print(domo_page.custom_attributes["parent_page"])
"parent_hierarchy", None)
domo_page.custom_attributes.get(
except PageRetrieval_byId_Error as e:
print(e)
None
None
with get_children_recursion
try:
= await DomoPage.get_by_id(
domo_page =30507758,
page_id=token_auth,
auth=False,
return_raw=True,
include_recursive_children=False,
include_recursive_parents= False
debug_api
)
print([
f"{fc['hierarchy']} - {fc['path']} : {fc['page'].title}"
for fc in domo_page.flat_children
])except dmde.DomoError as e:
print(e)
['0 - Welcome : Welcome']
Page_NoAccess
Page_NoAccess (page_id, page_title, domo_instance, function_name, parent_class)
base exception
DomoPage.test_page_access
DomoPage.test_page_access (suppress_no_access_error:bool=False, debug_api:bool=False, return_raw:bool=False, session:httpx.AsyncClient=None, debug_num_stacks_to_drop=2)
throws an error if user doesn’t have access to the page API returns the owners of the page
Type | Default | Details | |
---|---|---|---|
suppress_no_access_error | bool | False | suppresses error if user doesn’t have access |
debug_api | bool | False | |
return_raw | bool | False | |
session | AsyncClient | None | |
debug_num_stacks_to_drop | int | 2 |
sample implementation of test_page_access
= await DomoPage.get_by_id(page_id=30507758, auth=token_auth)
domo_page
= await domo_page.test_page_access(suppress_no_access_error=True)
res
res.response
{'pageId': 30507758,
'ownerId': 587894148,
'pageName': 'Welcome',
'owners': [{'id': 587894148,
'type': 'USER',
'displayName': 'Bryan Van Kampen'},
{'id': 1814479647, 'type': 'GROUP', 'displayName': 'Admin Test'}],
'pageAccess': True}
DomoPage.get_accesslist
DomoPage.get_accesslist (auth:domolibrary.client.DomoAuth.DomoAuth=None, return_raw:bool=False, debug_api:bool=False, session:httpx.AsyncClient=None, debug_num_stacks_to_drop=2)
sample get_accesslist
= DomoPage(id=page_id, auth=token_auth)
domo_page
await domo_page.get_accesslist(return_raw=False, debug_api=False))['domo_users'][0:5] (
[DomoUser(id='1022327751', display_name='James Johnson', email_address='james.johnson@domo.com', role_id=2097317660, department=None, title=None, avatar_key='/api/content/v1/avatar/USER/1022327751', phone_number='801-864-3010', web_landing_page=None, web_mobile_landing_page=None, employee_id=None, employee_number=None, hire_date=None, reports_to=None, publisher_domain=None, subscriber_domain=None, virtual_user_id=None, created_dt=datetime.datetime(2023, 4, 7, 17, 27, 58), last_activity_dt=datetime.datetime(2024, 1, 22, 20, 51, 7, 102000), custom_attributes={'is_explicit_share': False, 'group_membership': [DomoGroup(id=49793884, name='ADM | Orientation', type='open', is_system=False, description='', custom_attributes={'is_owner': False})], 'is_owner': False}, role=None, domo_api_clients=None, domo_access_tokens=None),
DomoUser(id='1180517272', display_name='Paige Farmer', email_address='paige.farmer@domo.com', role_id=2, department=None, title=None, avatar_key='/api/content/v1/avatar/USER/1180517272', phone_number=None, web_landing_page=None, web_mobile_landing_page=None, employee_id=None, employee_number=None, hire_date=None, reports_to=None, publisher_domain=None, subscriber_domain=None, virtual_user_id=None, created_dt=datetime.datetime(2023, 6, 6, 18, 53, 14), last_activity_dt=datetime.datetime(2024, 1, 22, 21, 29, 28, 655000), custom_attributes={'is_explicit_share': False, 'group_membership': [DomoGroup(id=49793884, name='ADM | Orientation', type='open', is_system=False, description='', custom_attributes={'is_owner': False})], 'is_owner': False}, role=None, domo_api_clients=None, domo_access_tokens=None),
DomoUser(id='1294899258', display_name='Savannah West', email_address='savannah.west@domo.com', role_id=2, department=None, title=None, avatar_key='/api/content/v1/avatar/USER/1294899258', phone_number=None, web_landing_page=None, web_mobile_landing_page=None, employee_id=None, employee_number=None, hire_date=None, reports_to=None, publisher_domain=None, subscriber_domain=None, virtual_user_id=None, created_dt=datetime.datetime(2023, 6, 6, 18, 57, 23), last_activity_dt=datetime.datetime(2024, 1, 22, 21, 38, 26, 750000), custom_attributes={'is_explicit_share': False, 'group_membership': [DomoGroup(id=49793884, name='ADM | Orientation', type='open', is_system=False, description='', custom_attributes={'is_owner': False})], 'is_owner': False}, role=None, domo_api_clients=None, domo_access_tokens=None),
DomoUser(id='1345408759', display_name='Alexis Lorenz (DataMaven)', email_address='DataMaven42@gmail.com', role_id=1, department='Owner', title='Major Domo Support Specialist', avatar_key='/api/content/v1/avatar/USER/1345408759', phone_number='518-496-4710', web_landing_page=None, web_mobile_landing_page=None, employee_id=None, employee_number=None, hire_date=1590156374000, reports_to='2009312032', publisher_domain=None, subscriber_domain=None, virtual_user_id=None, created_dt=datetime.datetime(2020, 5, 8, 17, 55, 20), last_activity_dt=datetime.datetime(2024, 10, 23, 15, 26, 6, 391000), custom_attributes={'is_explicit_share': True, 'group_membership': [], 'is_owner': False}, role=None, domo_api_clients=None, domo_access_tokens=None),
DomoUser(id='1387513974', display_name='Soren Dahl', email_address='soren.dahl@domo.com', role_id=2, department=None, title=None, avatar_key='/api/content/v1/avatar/USER/1387513974', phone_number=None, web_landing_page=None, web_mobile_landing_page=None, employee_id=None, employee_number=None, hire_date=None, reports_to=None, publisher_domain=None, subscriber_domain=None, virtual_user_id=None, created_dt=datetime.datetime(2023, 6, 6, 18, 56, 13), last_activity_dt=datetime.datetime(2024, 1, 22, 21, 43, 42, 732000), custom_attributes={'is_explicit_share': False, 'group_membership': [DomoGroup(id=49793884, name='ADM | Orientation', type='open', is_system=False, description='', custom_attributes={'is_owner': False})], 'is_owner': False}, role=None, domo_api_clients=None, domo_access_tokens=None)]
Sample update page layout by background color
try:
= await DomoPage.get_by_id(
domo_page =page_id, auth=token_auth, return_raw=False, include_layout=True
page_id
)
= domo_page.layout.get_body()
body
if not hasattr(body, "background"):
= dmpg_c.PageLayout.generate_new_background_body()
new_background_body "background"] = new_background_body
body[
"background"]["selectedColor"] = "#FF0000"
body[
print((await DomoPage.update_layout(auth=token_auth, body=body, layout_id=domo_page.layout.id)))
except dmde.DomoError as e:
print(e)
🛑 CRUD_Page_Error 🛑 - function: get_traceback || status 400 || unable to update layout 302522863 at domo-community
Sample implementation of add_page_owner
await token_auth.who_am_i()
= await dmdu.DomoUsers.all_users(auth = token_auth)
domo_users
await domo_page.add_owner( group_id_ls=[], user_id_ls=[token_auth.user_id]
)
ResponseGetData(status=200, response='successfully added owners to pages 384424178', is_success=True, parent_class=None)