8000 Merge branch 'development' into django-style-filters · scuml/server-client-python@1968461 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1968461

Browse files
authored
Merge branch 'development' into django-style-filters
2 parents a92f146 + 7409d30 commit 1968461

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+280
-89
lines changed

samples/create_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This script demonstrates how to create groups using the Tableau
33
# Server Client.
44
#
5-
# To run the script, you must have installed Python 2.7.9 or later.
5+
# To run the script, you must have installed Python 3.5 or later.
66
####
77

88

samples/create_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# parent_id.
55
#
66
#
7-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
7+
# To run the script, you must have installed Python 3.5 or later.
88
####
99

1010
import argparse

samples/create_schedules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This script demonstrates how to create schedules using the Tableau
33
# Server Client.
44
#
5-
# To run the script, you must have installed Python 2.7.9 or later.
5+
# To run the script, you must have installed Python 3.5 or later.
66
####
77

88

samples/download_view_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# For more information, refer to the documentations on 'Query View Image'
66
# (https://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm)
77
#
8-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
8+
# To run the script, you must have installed Python 3.5 or later.
99
####
1010

1111
import argparse

samples/filter_sort_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This script demonstrates how to filter groups using the Tableau
33
# Server Client.
44
#
5-
# To run the script, you must have installed Python 2.7.9 or later.
5+
# To run the script, you must have installed Python 3.5 or later.
66
####
77

88

samples/filter_sort_projects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# to filter and sort on the name of the projects present on site.
44
#
55
#
6-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
6+
# To run the script, you must have installed Python 3.5 or later.
77
####
88

99
import argparse

samples/kill_all_jobs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
####
22
# This script demonstrates how to kill all of the running jobs
33
#
4-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
4+
# To run the script, you must have installed Python 3.5 or later.
55
####
66

77
import argparse

samples/list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
####
22
# This script demonstrates how to list all of the workbooks or datasources
33
#
4-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
4+
# To run the script, you must have installed Python 3.5 or later.
55
####
66

77
import argparse

samples/login.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
####
22
# This script demonstrates how to log in to Tableau Server Client.
33
#
4-
# To run the script, you must have installed Python 2.7.9 or later.
4+
# To run the script, you must have installed Python 3.5 or later.
55
####
66

77
import argparse

samples/move_workbook_projects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# a workbook that matches a given name and update it to be in
55
# the desired project.
66
#
7-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
7+
# To run the script, you must have installed Python 3.5 or later.
88
####
99

1010
import argparse

samples/move_workbook_sites.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# a workbook that matches a given name, download the workbook,
55
# and then publish it to the destination site.
66
#
7-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
7+
# To run the script, you must have installed Python 3.5 or later.
88
####
99

1010
import argparse

samples/publish_workbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# For more information, refer to the documentations on 'Publish Workbook'
1212
# (https://onlinehelp.tableau.com/current/api/rest_api/en-us/help.htm)
1313
#
14-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
14+
# To run the script, you must have installed Python 3.5 or later.
1515
####
1616

1717
import argparse

samples/refresh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
####
22
# This script demonstrates how to use trigger a refresh on a datasource or workbook
33
#
4-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
4+
# To run the script, you must have installed Python 3.5 or later.
55
####
66

77
import argparse

samples/refresh_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This script demonstrates how to use the Tableau Server Client
33
# to query extract refresh tasks and run them as needed.
44
#
5-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
5+
# To run the script, you must have installed Python 3.5 or later.
66
####
77

88
import argparse

samples/set_http_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This script demonstrates how to set http options. It will set the option
33
# to not verify SSL certificate, and query all workbooks on site.
44
#
5-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
5+
# To run the script, you must have installed Python 3.5 or later.
66
####
77

88
import argparse

samples/update_connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
####
22
# This script demonstrates how to update a connections credentials on a server to embed the credentials
33
#
4-
# To run the script, you must have installed Python 2.7.X or 3.3 and later.
4+
# To run the script, you must have installed Python 3.5 or later.
55
####
66

77
import argparse

tableauserverclient/datetime_helpers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import datetime
22

3-
# This code below is from the python documentation for tzinfo: https://docs.python.org/2.3/lib/datetime-tzinfo.html
3+
# This code below is from the python documentation for
4+
# tzinfo: https://docs.python.org/2.3/lib/datetime-tzinfo.html
5+
46
ZERO = datetime.timedelta(0)
57
HOUR = datetime.timedelta(hours=1)
68

tableauserverclient/models/column_item.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import xml.etree.ElementTree as ET
22

3-
from .property_decorators import property_is_enum, property_not_empty
4-
from .exceptions import UnpopulatedPropertyError
3+
from .property_decorators import property_not_empty
54

65

76
class ColumnItem(object):

tableauserverclient/models/connection_item.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ def connection_type(self):
3232
return self._connection_type
3333

3434
def __repr__(self):
35-
return "<ConnectionItem#{_id} embed={embed_password} type={_connection_type} username={username}>"\
36-
.format(**self.__dict__)
35+
return (
36+
"<ConnectionItem#{_id} embed={embed_password} "
37+
"type={_connection_type} username={username}>".format(**self.__dict__)
38+
)
3739

3840
@classmethod
3941
def from_response(cls, resp, ns):
@@ -76,11 +78,13 @@ def from_xml_element(cls, parsed_response, ns):
7678
connection_item.server_address = connection_xml.get('serverAddress', None)
7779
connection_item.server_port = connection_xml.get('serverPort', None)
7880

79-
connection_credentials = connection_xml.find('.//t:connectionCredentials', namespaces=ns)
81+
connection_credentials = connection_xml.find(
82+
'.//t:connectionCredentials', namespaces=ns)
8083

8184
if connection_credentials is not None:
8285

83-
connection_item.connection_credentials = ConnectionCredentials.from_xml_element(connection_credentials)
86+
connection_item.connection_credentials = ConnectionCredentials.from_xml_element(
87+
connection_credentials)
8488

8589
return all_connection_items
8690

tableauserverclient/models/data_acceleration_report_item.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ def site(self):
2121
def sheet_uri(self):
2222
return self._sheet_uri
2323

24-
@property
25-
def site(self):
26-
return self._site
27-
2824
@property
2925
def unaccelerated_session_count(self):
3026
return self._unaccelerated_session_count

tableauserverclient/models/database_item.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import xml.etree.ElementTree as ET
22

3-
from .permissions_item import Permission
4-
53
from .property_decorators import property_is_enum, property_not_empty, property_is_boolean
64
from .exceptions import UnpopulatedPropertyError
75

tableauserverclient/models/flow_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import xml.etree.ElementTree as ET
22
from .exceptions import UnpopulatedPropertyError
3-
from .property_decorators import property_not_nullable, property_is_boolean
3+
from .property_decorators import property_not_nullable
44
from .tag_item import TagItem
55
from ..datetime_helpers import parse_datetime
66
import copy

tableauserverclient/models/interval_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def interval(self, interval_value):
173173
try:
174174
if not (1 <= int(interval_value) <= 31):
175175
raise ValueError(error)
176-
except ValueError as e:
57AE 176+
except ValueError:
177177
if interval_value != "LastDay":
178178
raise ValueError(error)
179179

tableauserverclient/models/job_item.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import xml.etree.ElementTree as ET
22
from ..datetime_helpers import parse_datetime
3-
from .target import Target
4-
from ..datetime_helpers import parse_datetime
53

64

75
class JobItem(object):

tableauserverclient/models/pagination_item.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def from_response(cls, resp, ns):
3131
return pagination_item
3232

3333
@classmethod
34-
def from_single_page_list(cls, l):
34+
def from_single_page_list(cls, single_page_list):
3535
item = cls()
3636
item._page_number = 1
37-
item._page_size = len(l)
38-
item._total_available = len(l)
37+
item._page_size = len(single_page_list)
38+
item._total_available = len(single_page_list)
3939

4040
return item

tableauserverclient/models/personal_access_token_auth.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ def __init__(self, token_name, personal_access_token, site_id=''):
88

99
@property
1010
def credentials(self):
11-
return {'personalAccessTokenName': self.token_name, 'personalAccessTokenSecret': self.personal_access_token}
11+
return {
12+
'personalAccessTokenName': self.token_name,
13+
'personalAccessTokenSecret': self.personal_access_token
14+
}
1215

1316
def __repr__(self):
14-
return "<PersonalAccessToken name={} token={}>".format(self.token_name, self.personal_access_token)
17+
return "<PersonalAccessToken name={} token={}>".format(
18+
self.token_name, self.personal_access_token
19+
)

tableauserverclient/models/project_item.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ def name(self, value):
7777
def is_default(self):
7878
return self.name.lower() == 'default'
7979

80-
def _parse_common_tags(self, project_xml):
80+
def _parse_common_tags(self, project_xml, ns):
8181
if not isinstance(project_xml, ET.Element):
82-
project_xml = ET.fromstring(project_xml).find('.//t:project', namespaces=NAMESPACE)
82+
project_xml = ET.fromstring(project_xml).find('.//t:project', namespaces=ns)
8383

8484
if project_xml is not None:
8585
(_, name, description, content_permissions, parent_id) = self._parse_element(project_xml)

tableauserverclient/models/subscription_item.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import xml.etree.ElementTree as ET
2-
from .exceptions import UnpopulatedPropertyError
32
from .target import Target
43

54

tableauserverclient/models/table_item.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import xml.etree.ElementTree as ET
22

3-
from .permissions_item import Permission
4-
from .column_item import ColumnItem
5-
6-
from .property_decorators import property_is_enum, property_not_empty, property_is_boolean
3+
from .property_decorators import property_not_empty, property_is_boolean
74
from .exceptions import UnpopulatedPropertyError
85

96

tableauserverclient/models/task_item.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def from_response(cls, xml, ns, task_type=Type.ExtractRefresh):
3636

3737
@classmethod
3838
def _parse_element(cls, element, ns):
39-
schedule_id = None
4039
schedule_item = None
4140
target = None
4241
last_run_at = None

tableauserverclient/models/webhook_item.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import xml.etree.ElementTree as ET
2-
from .exceptions import UnpopulatedPropertyError
3-
from .property_decorators import property_not_nullable, property_is_boolean, property_is_data_acceleration_config
4-
from .tag_item import TagItem
5-
from .view_item import ViewItem
6-
from .permissions_item import PermissionsRule
7-
from ..datetime_helpers import parse_datetime
2+
83
import re
94

105

@@ -86,4 +81,5 @@ def _parse_element(webhook_xml, ns):
8681
return id, name, url, event, owner_id
8782

8883
def __repr__(self):
89-
return "<Webhook id={} name={} url={} event={}>".format(self.id, self.name, self.url, self.event)
84+
return "<Webhook id={} name={} url={} event={}>".format(
85+
self.id, self.name, self.url, self.event)

tableauserverclient/server/endpoint/data_acceleration_report_endpoint.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def __init__(self, parent_srv):
1818

1919
@property
2020
def baseurl(self):
21-
return "{0}/sites/{1}/dataAccelerationReport".format(self.parent_srv.baseurl, self.parent_srv.site_id)
21+
return "{0}/sites/{1}/dataAccelerationReport".format(
22+
self.parent_srv.baseurl, self.parent_srv.site_id)
2223

2324
@api(version="3.8")
2425
def get(self, req_options=None):

tableauserverclient/server/endpoint/databases_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .permissions_endpoint import _PermissionsEndpoint
44
from .default_permissions_endpoint import _DefaultPermissionsEndpoint
55

6-
from .. import RequestFactory, DatabaseItem, PaginationItem, PermissionsRule, Permission
6+
from .. import RequestFactory, DatabaseItem, TableItem, PaginationItem, Permission
77

88
import logging
99

tableauserverclient/server/endpoint/datasources_endpoint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from ..query import QuerySet
88
from ...filesys_helpers import to_filename, make_download_path
99
from ...models.job_item import JobItem
10+
1011
import os
1112
import logging
1213
import copy
@@ -127,7 +128,8 @@ def update(self, datasource_item):
127128
server_response = self.put_request(url, update_req)
128129
logger.info('Updated datasource item (ID: {0})'.format(datasource_item.id))
129130
updated_datasource = copy.copy(datasource_item)
130-
return updated_datasource._parse_common_elements(server_response.content, self.parent_srv.namespace)
131+
return updated_datasource._parse_common_elements(
132+
server_response.content, self.parent_srv.namespace)
131133

132134
# Update datasource connections
133135
@api(version="2.3")

tableauserverclient/server/endpoint/default_permissions_endpoint.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,22 @@
33
from .. import RequestFactory
44
from ...models import PermissionsRule
55

6-
from .endpoint import Endpoint, api
6+
from .endpoint import Endpoint
77
from .exceptions import MissingRequiredFieldError
88

99

1010
logger = logging.getLogger(__name__)
1111

1212

1313
class _DefaultPermissionsEndpoint(Endpoint):
14-
''' Adds default-permission model to another endpoint
14+
""" Adds default-permission model to another endpoint
1515
1616
Tableau default-permissions model applies only to databases and projects
1717
and then takes an object type in the uri to set the defaults.
1818
This class is meant to be instantated inside a parent endpoint which
1919
has these supported endpoints
20-
'''
20+
"""
21+
2122
def __init__(self, parent_srv, owner_baseurl):
2223
super(_DefaultPermissionsEndpoint, self).__init__(parent_srv)
2324

tableauserverclient/server/endpoint/endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _check_status(self, server_response):
7474
# we convert this to a better exception and pass through the raw
7575
# response body
7676
raise NonXMLResponseError(server_response.content)
77-
except Exception as e:
77+
except Exception:
7878
# anything else re-raise here
7979
raise
8080

0 commit comments

Comments
 (0)
0