Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
jacalata committed Oct 4, 2024
1 parent 81da0d7 commit 7c58b5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions samples/explore_favorites.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import argparse
import logging
import tableauserverclient as TSC
from tableauserverclient import Resource


def main():
Expand Down Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions samples/filter_sort_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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()

0 comments on commit 7c58b5a

Please sign in to comment.