8000 Merge pull request #29 from tableau/reorder_return_variables · bonomali/server-client-python@82f251e · GitHub
[go: up one dir, main page]

Skip to content

Commit 82f251e

Browse files
authored
Merge pull request tableau#29 from tableau/reorder_return_variables
reversed the order of return variables for all .get() calls
2 parents f46afac + 8df6a77 commit 82f251e

23 files changed

+39
-36
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tableau_auth = tableauserverclient.TableauAuth('USERNAME', 'PASSWORD')
4444
server = tableauserverclient.Server('SERVER')
4545

4646
with server.auth.sign_in(tableau_auth):
47-
pagination_info, all_workbooks = server.workbooks.get()
47+
all_workbooks, pagination_item = server.workbooks.get()
4848
```
4949

5050
###Server Client Samples

samples/explore_datasource.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
server = TSC.Server(args.server)
3737
with server.auth.sign_in(tableau_auth):
3838
# Query projects for use when demonstrating publishing and updating
39-
pagination_item, all_projects = server.projects.get()
39+
all_projects, pagination_item = server.projects.get()
4040
default_project = next((project for project in all_projects if project.is_default()), None)
4141

4242
# Publish datasource if publish flag is set (-publish, -p)
@@ -49,7 +49,7 @@
4949
print("Publish failed. Could not find the default project.")
5050

5151
# Gets all datasource items
52-
pagination_item, all_datasources = server.datasources.get()
52+
all_datasources, pagination_item = server.datasources.get()
5353
print("\nThere are {} datasources on site: ".format(pagination_item.total_available))
5454
print([datasource.name for datasource in all_datasources])
5555

samples/explore_workbook.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
# Publish workbook if publish flag is set (-publish, -p)
4242
if args.publish:
43-
pagination_info, all_projects = server.projects.get()
43+
all_projects, pagination_item = server.projects.get()
4444
default_project = next((project for project in all_projects if project.is_default()), None)
4545

4646
if default_project is not None:
@@ -51,7 +51,7 @@
5151
print('Publish failed. Could not find the default project.')
5252

5353
# Gets all workbook items
54-
pagination_item, all_workbooks = server.workbooks.get()
54+
all_workbooks, pagination_item = server.workbooks.get()
5555
print("\nThere are {} workbooks on site: ".format(pagination_item.total_available))
5656
print([workbook.name for workbook in all_workbooks])
5757

samples/move_workbook_projects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
req_option = TSC.RequestOptions()
3636
req_option.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name,
3737
TSC.RequestOptions.Operator.Equals, args.workbook_name))
38-
pagination_info, all_workbooks = server.workbooks.get(req_option)
38+
all_workbooks, pagination_item = server.workbooks.get(req_option)
3939

4040
# Step 3: Find destination project
41-
pagination_info, all_projects = server.projects.get()
41+
all_projects, pagination_item = server.projects.get()
4242
dest_project = next((project for project in all_projects if project.name == args.destination_project), None)
4343

4444
if dest_project is not None:

samples/move_workbook_sites.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
req_option = TSC.RequestOptions()
4343
req_option.filter.add(TSC.Filter(TSC.RequestOptions.Field.Name,
4444
TSC.RequestOptions.Operator.Equals, args.workbook_name))
45-
pagination_info, all_workbooks = source_server.workbooks.get(req_option)
45+
all_workbooks, pagination_item = source_server.workbooks.get(req_option)
4646

4747
# Step 3: Download workbook to a temp directory
4848
if len(all_workbooks) == 0:

samples/publish_workbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
with server.auth.sign_in(tableau_auth):
4040

4141
# Step 2: Get all the projects on server, then look for the default one.
42-
pagination_info, all_projects = server.projects.get()
42+
all_projects, pagination_item = server.projects.get()
4343
default_project = next((project for project in all_projects if project.is_default()), None)
4444

4545
# Step 3: If default project is found, form a new workbook item and publish.

samples/set_http_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
with server.auth.sign_in(tableau_auth):
3737

3838
# Step 3: Query all workbooks and list them
39-
pagination_info, all_workbooks = server.workbooks.get()
40-
print('{0} workbooks found. Showing {1}:'.format(pagination_info.total_available, pagination_info.page_size))
39+
all_workbooks, pagination_item = server.workbooks.get()
40+
print('{0} workbooks found. Showing {1}:'.format(pagination_item.total_available, pagination_item.page_size))
4141
for workbook in all_workbooks:
4242
print('\t{0} (ID: {1})'.format(workbook.name, workbook.id))

tableauserverclient/server/endpoint/datasources_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get(self, req_options=None):
3131
server_response = self.get_request(url, req_options)
3232
pagination_item = PaginationItem.from_response(server_response.content)
3333
all_datasource_items = DatasourceItem.from_response(server_response.content)
34-
return pagination_item, all_datasource_items
34+
return all_datasource_items, pagination_item
3535

3636
# Get 1 datasource by id
3737
def get_by_id(self, datasource_id):

tableauserverclient/server/endpoint/endpoint.py

Lines changed: 6 additions & 3 deletions
< 10BC0 button class="Button Button--iconOnly Button--invisible" aria-label="More options" id=":R4hktlab:" aria-haspopup="true" aria-expanded="false" tabindex="0">
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def get_request(self, url, request_object=None):
2424
**self.parent_srv.http_options)
2525
self._check_status(server_response)
2626
if server_response.encoding:
27-
logger.debug(u'Server response from {0}: \n\t{1}'.format(url, server_response.content.decode(server_response.encoding)))
27+
logger.debug(u'Server response from {0}: \n\t{1}'.format(
28+
url, server_response.content.decode(server_response.encoding)))
2829
return server_response
2930

3031
def delete_request(self, url):
@@ -42,7 +43,8 @@ def put_request(self, url, xml_request, content_type='text/xml'):
4243
**self.parent_srv.http_options)
4344
self._check_status(server_response)
4445
if server_response.encoding:
45-
logger.debug(u'Server response from {0}: \n\t{1}'.format(url, server_response.content.decode(server_response.encoding)))
46+
logger.debug(u'Server response from {0}: \n\t{1}'.format(
47+
url, server_response.content.decode(server_response.encoding)))
4648
return server_response
4749

4850
def post_request(self, url, xml_request, content_type='text/xml'):
@@ -53,5 +55,6 @@ def post_request(self, url, xml_request, content_type='text/xml'):
5355
**self.parent_srv.http_options)
5456
self._check_status(server_response)
5557
if server_response.encoding:
56-
logger.debug(u'Server response from {0}: \n\t{1}'.format(url, server_response.content.decode(server_response.encoding)))
58+
logger.debug(u'Server response from {0}: \n\t{1}'.format(
59+
url, server_response.content.decode(server_response.encoding)))
5760
return server_response

tableauserverclient/server/endpoint/groups_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get(self, req_options=None):
2222
server_response = self.get_request(url, req_options)
2323
pagination_item = PaginationItem.from_response(server_response.content)
2424
all_group_items = GroupItem.from_response(server_response.content)
25-
return pagination_item, all_group_items
25+
return all_group_items, pagination_item
2626

2727
# Gets all users in a given group
2828
def populate_users(self, group_item, req_options=None):

0 commit comments

Comments
 (0)
0