From 7c58b5aa02057d6281db6a1b62d8ae16ce285fe4 Mon Sep 17 00:00:00 2001 From: "jac.fitzgerald" Date: Fri, 4 Oct 2024 14:12:24 -0700 Subject: [PATCH] format --- samples/explore_favorites.py | 3 +-- samples/filter_sort_groups.py | 13 +++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/samples/explore_favorites.py b/samples/explore_favorites.py index 243e91954..09f465439 100644 --- a/samples/explore_favorites.py +++ b/samples/explore_favorites.py @@ -3,7 +3,6 @@ import argparse import logging import tableauserverclient as TSC -from tableauserverclient import Resource def main(): @@ -47,7 +46,7 @@ def main(): all_workbook_items, pagination_item = server.workbooks.get() if all_workbook_items is not None and len(all_workbook_items) > 0: my_workbook: TSC.WorkbookItem = all_workbook_items[0] - server.favorites.add_favorite(server, user, Resource.Workbook.name(), all_workbook_items[0]) + server.favorites.add_favorite(server, user, TSC.Resource.Workbook.name(), all_workbook_items[0]) print( "Workbook added to favorites. Workbook Name: {}, Workbook ID: {}".format( my_workbook.name, my_workbook.id diff --git a/samples/filter_sort_groups.py b/samples/filter_sort_groups.py index d580acee2..bb76ff44f 100644 --- a/samples/filter_sort_groups.py +++ b/samples/filter_sort_groups.py @@ -47,7 +47,7 @@ def main(): logging.basicConfig(level=logging_level) tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site) - server = TSC.Server(args.server, use_server_version=True, http_options={"verify":False}) + server = TSC.Server(args.server, use_server_version=True, http_options={"verify": False}) with server.auth.sign_in(tableau_auth): group_name = "SALES NORTHWEST" # Try to create a group named "SALES NORTHWEST" @@ -59,10 +59,7 @@ def main(): # we no longer need to encode the space options = TSC.RequestOptions() - options.filter.add( - TSC.Filter(TSC.RequestOptions.Field.Name, TSC.RequestOptions.Operator.Equals, group_name - ) - ) + options.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name, TSC.RequestOptions.Operator.Equals, group_name)) filtered_groups, _ = server.groups.get(req_options=options) # Result can either be a matching group or an empty list @@ -74,14 +71,14 @@ def main(): print(error) print("---") - + # Or, try the above with the django style filtering try: group = server.groups.filter(name=group_name)[0] print(group) except IndexError: print(f"No group named '{group_name}' found") - + print("====") options = TSC.RequestOptions() @@ -109,7 +106,7 @@ def main(): for group in server.groups.filter(name__in=groups).order_by("-name"): print(group.name) """ - + if __name__ == "__main__": main()