tableauserverclient 0.34__py3-none-any.whl → 0.36__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tableauserverclient/__init__.py +5 -1
- tableauserverclient/{_version.py → bin/_version.py} +3 -3
- tableauserverclient/models/connection_credentials.py +17 -1
- tableauserverclient/models/connection_item.py +38 -0
- tableauserverclient/models/custom_view_item.py +49 -5
- tableauserverclient/models/flow_item.py +49 -4
- tableauserverclient/models/group_item.py +40 -0
- tableauserverclient/models/job_item.py +65 -0
- tableauserverclient/models/project_item.py +39 -1
- tableauserverclient/models/task_item.py +30 -0
- tableauserverclient/models/view_item.py +55 -3
- tableauserverclient/models/webhook_item.py +33 -0
- tableauserverclient/models/workbook_item.py +26 -1
- tableauserverclient/server/endpoint/auth_endpoint.py +4 -2
- tableauserverclient/server/endpoint/custom_views_endpoint.py +197 -12
- tableauserverclient/server/endpoint/datasources_endpoint.py +14 -9
- tableauserverclient/server/endpoint/flows_endpoint.py +314 -0
- tableauserverclient/server/endpoint/groups_endpoint.py +325 -11
- tableauserverclient/server/endpoint/jobs_endpoint.py +109 -0
- tableauserverclient/server/endpoint/projects_endpoint.py +600 -0
- tableauserverclient/server/endpoint/tasks_endpoint.py +78 -0
- tableauserverclient/server/endpoint/views_endpoint.py +243 -2
- tableauserverclient/server/endpoint/webhooks_endpoint.py +77 -0
- tableauserverclient/server/endpoint/workbooks_endpoint.py +6 -4
- tableauserverclient/server/pager.py +24 -0
- tableauserverclient/server/request_factory.py +20 -1
- tableauserverclient/server/request_options.py +126 -2
- tableauserverclient/server/server.py +11 -1
- tableauserverclient/server/sort.py +14 -0
- {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/METADATA +3 -3
- {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/RECORD +35 -35
- {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/WHEEL +1 -1
- {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/LICENSE +0 -0
- {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/LICENSE.versioneer +0 -0
- {tableauserverclient-0.34.dist-info → tableauserverclient-0.36.dist-info}/top_level.txt +0 -0
tableauserverclient/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from tableauserverclient._version import get_versions
|
|
1
|
+
from tableauserverclient.bin._version import get_versions
|
|
2
2
|
from tableauserverclient.namespace import NEW_NAMESPACE as DEFAULT_NAMESPACE
|
|
3
3
|
from tableauserverclient.models import (
|
|
4
4
|
BackgroundJobItem,
|
|
@@ -133,3 +133,7 @@ __all__ = [
|
|
|
133
133
|
"WeeklyInterval",
|
|
134
134
|
"WorkbookItem",
|
|
135
135
|
]
|
|
136
|
+
|
|
137
|
+
from .bin import _version
|
|
138
|
+
|
|
139
|
+
__version__ = _version.get_versions()["version"]
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "
|
|
11
|
+
"date": "2025-01-10T10:20:30-0800",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "0.
|
|
14
|
+
"full-revisionid": "42cecfe268d494284ca74b49aa4e9bfb6cfa197a",
|
|
15
|
+
"version": "0.36"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -2,11 +2,27 @@ from .property_decorators import property_is_boolean
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class ConnectionCredentials:
|
|
5
|
-
"""
|
|
5
|
+
"""
|
|
6
|
+
Connection Credentials for Workbooks and Datasources publish request.
|
|
6
7
|
|
|
7
8
|
Consider removing this object and other variables holding secrets
|
|
8
9
|
as soon as possible after use to avoid them hanging around in memory.
|
|
9
10
|
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
name: str
|
|
14
|
+
The username for the connection.
|
|
15
|
+
|
|
16
|
+
password: str
|
|
17
|
+
The password used for the connection.
|
|
18
|
+
|
|
19
|
+
embed: bool, default True
|
|
20
|
+
Determines whether to embed the password (True) for the workbook or data source connection or not (False).
|
|
21
|
+
|
|
22
|
+
oauth: bool, default False
|
|
23
|
+
Determines whether to use OAuth for the connection (True) or not (False).
|
|
24
|
+
For more information see: https://help.tableau.com/current/server/en-us/protected_auth.htm
|
|
25
|
+
|
|
10
26
|
"""
|
|
11
27
|
|
|
12
28
|
def __init__(self, name, password, embed=True, oauth=False):
|
|
@@ -9,6 +9,44 @@ from tableauserverclient.helpers.logging import logger
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class ConnectionItem:
|
|
12
|
+
"""
|
|
13
|
+
Corresponds to workbook and data source connections.
|
|
14
|
+
|
|
15
|
+
Attributes
|
|
16
|
+
----------
|
|
17
|
+
datasource_id: str
|
|
18
|
+
The identifier of the data source.
|
|
19
|
+
|
|
20
|
+
datasource_name: str
|
|
21
|
+
The name of the data source.
|
|
22
|
+
|
|
23
|
+
id: str
|
|
24
|
+
The identifier of the connection.
|
|
25
|
+
|
|
26
|
+
connection_type: str
|
|
27
|
+
The type of connection.
|
|
28
|
+
|
|
29
|
+
username: str
|
|
30
|
+
The username for the connection. (see ConnectionCredentials)
|
|
31
|
+
|
|
32
|
+
password: str
|
|
33
|
+
The password used for the connection. (see ConnectionCredentials)
|
|
34
|
+
|
|
35
|
+
embed_password: bool
|
|
36
|
+
Determines whether to embed the password (True) for the workbook or data source connection or not (False). (see ConnectionCredentials)
|
|
37
|
+
|
|
38
|
+
server_address: str
|
|
39
|
+
The server address for the connection.
|
|
40
|
+
|
|
41
|
+
server_port: str
|
|
42
|
+
The port used for the connection.
|
|
43
|
+
|
|
44
|
+
connection_credentials: ConnectionCredentials
|
|
45
|
+
The Connection Credentials object containing authentication details for
|
|
46
|
+
the connection. Replaces username/password/embed_password when
|
|
47
|
+
publishing a flow, document or workbook file in the request body.
|
|
48
|
+
"""
|
|
49
|
+
|
|
12
50
|
def __init__(self):
|
|
13
51
|
self._datasource_id: Optional[str] = None
|
|
14
52
|
self._datasource_name: Optional[str] = None
|
|
@@ -5,14 +5,58 @@ from defusedxml.ElementTree import fromstring, tostring
|
|
|
5
5
|
from typing import Callable, Optional
|
|
6
6
|
from collections.abc import Iterator
|
|
7
7
|
|
|
8
|
-
from .exceptions import UnpopulatedPropertyError
|
|
9
|
-
from .user_item import UserItem
|
|
10
|
-
from .view_item import ViewItem
|
|
11
|
-
from .workbook_item import WorkbookItem
|
|
12
|
-
from
|
|
8
|
+
from tableauserverclient.models.exceptions import UnpopulatedPropertyError
|
|
9
|
+
from tableauserverclient.models.user_item import UserItem
|
|
10
|
+
from tableauserverclient.models.view_item import ViewItem
|
|
11
|
+
from tableauserverclient.models.workbook_item import WorkbookItem
|
|
12
|
+
from tableauserverclient.datetime_helpers import parse_datetime
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class CustomViewItem:
|
|
16
|
+
"""
|
|
17
|
+
Represents a Custom View item on Tableau Server.
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
id : Optional[str]
|
|
22
|
+
The ID of the Custom View item.
|
|
23
|
+
|
|
24
|
+
name : Optional[str]
|
|
25
|
+
The name of the Custom View item.
|
|
26
|
+
|
|
27
|
+
Attributes
|
|
28
|
+
----------
|
|
29
|
+
content_url : Optional[str]
|
|
30
|
+
The content URL of the Custom View item.
|
|
31
|
+
|
|
32
|
+
created_at : Optional[datetime]
|
|
33
|
+
The date and time the Custom View item was created.
|
|
34
|
+
|
|
35
|
+
image: bytes
|
|
36
|
+
The image of the Custom View item. Must be populated first.
|
|
37
|
+
|
|
38
|
+
pdf: bytes
|
|
39
|
+
The PDF of the Custom View item. Must be populated first.
|
|
40
|
+
|
|
41
|
+
csv: Iterator[bytes]
|
|
42
|
+
The CSV of the Custom View item. Must be populated first.
|
|
43
|
+
|
|
44
|
+
shared : Optional[bool]
|
|
45
|
+
Whether the Custom View item is shared.
|
|
46
|
+
|
|
47
|
+
updated_at : Optional[datetime]
|
|
48
|
+
The date and time the Custom View item was last updated.
|
|
49
|
+
|
|
50
|
+
owner : Optional[UserItem]
|
|
51
|
+
The id of the owner of the Custom View item.
|
|
52
|
+
|
|
53
|
+
workbook : Optional[WorkbookItem]
|
|
54
|
+
The id of the workbook the Custom View item belongs to.
|
|
55
|
+
|
|
56
|
+
view : Optional[ViewItem]
|
|
57
|
+
The id of the view the Custom View item belongs to.
|
|
58
|
+
"""
|
|
59
|
+
|
|
16
60
|
def __init__(self, id: Optional[str] = None, name: Optional[str] = None) -> None:
|
|
17
61
|
self._content_url: Optional[str] = None # ?
|
|
18
62
|
self._created_at: Optional["datetime"] = None
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import copy
|
|
2
2
|
import datetime
|
|
3
3
|
import xml.etree.ElementTree as ET
|
|
4
|
-
from typing import Optional
|
|
4
|
+
from typing import Iterable, Optional
|
|
5
5
|
|
|
6
6
|
from defusedxml.ElementTree import fromstring
|
|
7
7
|
|
|
@@ -15,6 +15,51 @@ from tableauserverclient.models.tag_item import TagItem
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class FlowItem:
|
|
18
|
+
"""
|
|
19
|
+
Represents a Tableau Flow item.
|
|
20
|
+
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
project_id: str
|
|
24
|
+
The ID of the project that the flow belongs to.
|
|
25
|
+
|
|
26
|
+
name: Optional[str]
|
|
27
|
+
The name of the flow.
|
|
28
|
+
|
|
29
|
+
Attributes
|
|
30
|
+
----------
|
|
31
|
+
connections: Iterable[ConnectionItem]
|
|
32
|
+
The connections associated with the flow. This property is not populated
|
|
33
|
+
by default and must be populated by calling the `populate_connections`
|
|
34
|
+
method.
|
|
35
|
+
|
|
36
|
+
created_at: Optional[datetime.datetime]
|
|
37
|
+
The date and time when the flow was created.
|
|
38
|
+
|
|
39
|
+
description: Optional[str]
|
|
40
|
+
The description of the flow.
|
|
41
|
+
|
|
42
|
+
dqws: Iterable[DQWItem]
|
|
43
|
+
The data quality warnings associated with the flow. This property is not
|
|
44
|
+
populated by default and must be populated by calling the `populate_dqws`
|
|
45
|
+
method.
|
|
46
|
+
|
|
47
|
+
id: Optional[str]
|
|
48
|
+
The ID of the flow.
|
|
49
|
+
|
|
50
|
+
name: Optional[str]
|
|
51
|
+
The name of the flow.
|
|
52
|
+
|
|
53
|
+
owner_id: Optional[str]
|
|
54
|
+
The ID of the user who owns the flow.
|
|
55
|
+
|
|
56
|
+
project_name: Optional[str]
|
|
57
|
+
The name of the project that the flow belongs to.
|
|
58
|
+
|
|
59
|
+
tags: set[str]
|
|
60
|
+
The tags associated with the flow.
|
|
61
|
+
"""
|
|
62
|
+
|
|
18
63
|
def __repr__(self):
|
|
19
64
|
return "<Flow {} '{}' ({}) Project={} createdAt={}".format(
|
|
20
65
|
self._id, self.name, self.description, self.project_id, self.created_at
|
|
@@ -33,9 +78,9 @@ class FlowItem:
|
|
|
33
78
|
self.tags: set[str] = set()
|
|
34
79
|
self.description: Optional[str] = None
|
|
35
80
|
|
|
36
|
-
self._connections: Optional[ConnectionItem] = None
|
|
37
|
-
self._permissions: Optional[Permission] = None
|
|
38
|
-
self._data_quality_warnings: Optional[DQWItem] = None
|
|
81
|
+
self._connections: Optional[Iterable[ConnectionItem]] = None
|
|
82
|
+
self._permissions: Optional[Iterable[Permission]] = None
|
|
83
|
+
self._data_quality_warnings: Optional[Iterable[DQWItem]] = None
|
|
39
84
|
|
|
40
85
|
@property
|
|
41
86
|
def connections(self):
|
|
@@ -12,6 +12,46 @@ if TYPE_CHECKING:
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class GroupItem:
|
|
15
|
+
"""
|
|
16
|
+
The GroupItem class contains the attributes for the group resources on
|
|
17
|
+
Tableau Server. The GroupItem class defines the information you can request
|
|
18
|
+
or query from Tableau Server. The class members correspond to the attributes
|
|
19
|
+
of a server request or response payload.
|
|
20
|
+
|
|
21
|
+
Parameters
|
|
22
|
+
----------
|
|
23
|
+
name: str
|
|
24
|
+
The name of the group.
|
|
25
|
+
|
|
26
|
+
domain_name: str
|
|
27
|
+
The name of the Active Directory domain ("local" if local authentication is used).
|
|
28
|
+
|
|
29
|
+
Properties
|
|
30
|
+
----------
|
|
31
|
+
users: Pager[UserItem]
|
|
32
|
+
The users in the group. Must be populated with a call to `populate_users()`.
|
|
33
|
+
|
|
34
|
+
id: str
|
|
35
|
+
The unique identifier for the group.
|
|
36
|
+
|
|
37
|
+
minimum_site_role: str
|
|
38
|
+
The minimum site role for users in the group. Use the `UserItem.Roles` enum.
|
|
39
|
+
Users in the group cannot have their site role set lower than this value.
|
|
40
|
+
|
|
41
|
+
license_mode: str
|
|
42
|
+
The mode defining when to apply licenses for group members. When the
|
|
43
|
+
mode is onLogin, a license is granted for each group member when they
|
|
44
|
+
login to a site. When the mode is onSync, a license is granted for group
|
|
45
|
+
members each time the domain is synced.
|
|
46
|
+
|
|
47
|
+
Examples
|
|
48
|
+
--------
|
|
49
|
+
>>> # Create a new group item
|
|
50
|
+
>>> newgroup = TSC.GroupItem('My Group')
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
"""
|
|
54
|
+
|
|
15
55
|
tag_name: str = "group"
|
|
16
56
|
|
|
17
57
|
class LicenseMode:
|
|
@@ -8,6 +8,71 @@ from tableauserverclient.models.flow_run_item import FlowRunItem
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class JobItem:
|
|
11
|
+
"""
|
|
12
|
+
Using the TSC library, you can get information about an asynchronous process
|
|
13
|
+
(or job) on the server. These jobs can be created when Tableau runs certain
|
|
14
|
+
tasks that could be long running, such as importing or synchronizing users
|
|
15
|
+
from Active Directory, or running an extract refresh. For example, the REST
|
|
16
|
+
API methods to create or update groups, to run an extract refresh task, or
|
|
17
|
+
to publish workbooks can take an asJob parameter (asJob-true) that creates a
|
|
18
|
+
background process (the job) to complete the call. Information about the
|
|
19
|
+
asynchronous job is returned from the method.
|
|
20
|
+
|
|
21
|
+
If you have the identifier of the job, you can use the TSC library to find
|
|
22
|
+
out the status of the asynchronous job.
|
|
23
|
+
|
|
24
|
+
The job properties are defined in the JobItem class. The class corresponds
|
|
25
|
+
to the properties for jobs you can access using the Tableau Server REST API.
|
|
26
|
+
The job methods are based upon the endpoints for jobs in the REST API and
|
|
27
|
+
operate on the JobItem class.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
id_ : str
|
|
32
|
+
The identifier of the job.
|
|
33
|
+
|
|
34
|
+
job_type : str
|
|
35
|
+
The type of job.
|
|
36
|
+
|
|
37
|
+
progress : str
|
|
38
|
+
The progress of the job.
|
|
39
|
+
|
|
40
|
+
created_at : datetime.datetime
|
|
41
|
+
The date and time the job was created.
|
|
42
|
+
|
|
43
|
+
started_at : Optional[datetime.datetime]
|
|
44
|
+
The date and time the job was started.
|
|
45
|
+
|
|
46
|
+
completed_at : Optional[datetime.datetime]
|
|
47
|
+
The date and time the job was completed.
|
|
48
|
+
|
|
49
|
+
finish_code : int
|
|
50
|
+
The finish code of the job. 0 for success, 1 for failure, 2 for cancelled.
|
|
51
|
+
|
|
52
|
+
notes : Optional[list[str]]
|
|
53
|
+
Contains detailed notes about the job.
|
|
54
|
+
|
|
55
|
+
mode : Optional[str]
|
|
56
|
+
|
|
57
|
+
workbook_id : Optional[str]
|
|
58
|
+
The identifier of the workbook associated with the job.
|
|
59
|
+
|
|
60
|
+
datasource_id : Optional[str]
|
|
61
|
+
The identifier of the datasource associated with the job.
|
|
62
|
+
|
|
63
|
+
flow_run : Optional[FlowRunItem]
|
|
64
|
+
The flow run associated with the job.
|
|
65
|
+
|
|
66
|
+
updated_at : Optional[datetime.datetime]
|
|
67
|
+
The date and time the job was last updated.
|
|
68
|
+
|
|
69
|
+
workbook_name : Optional[str]
|
|
70
|
+
The name of the workbook associated with the job.
|
|
71
|
+
|
|
72
|
+
datasource_name : Optional[str]
|
|
73
|
+
The name of the datasource associated with the job.
|
|
74
|
+
"""
|
|
75
|
+
|
|
11
76
|
class FinishCode:
|
|
12
77
|
"""
|
|
13
78
|
Status codes as documented on
|
|
@@ -9,6 +9,44 @@ from tableauserverclient.models.property_decorators import property_is_enum, pro
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class ProjectItem:
|
|
12
|
+
"""
|
|
13
|
+
The project resources for Tableau are defined in the ProjectItem class. The
|
|
14
|
+
class corresponds to the project resources you can access using the Tableau
|
|
15
|
+
Server REST API.
|
|
16
|
+
|
|
17
|
+
Parameters
|
|
18
|
+
----------
|
|
19
|
+
name : str
|
|
20
|
+
Name of the project.
|
|
21
|
+
|
|
22
|
+
description : str
|
|
23
|
+
Description of the project.
|
|
24
|
+
|
|
25
|
+
content_permissions : str
|
|
26
|
+
Sets or shows the permissions for the content in the project. The
|
|
27
|
+
options are either LockedToProject, ManagedByOwner or
|
|
28
|
+
LockedToProjectWithoutNested.
|
|
29
|
+
|
|
30
|
+
parent_id : str
|
|
31
|
+
The id of the parent project. Use this option to create project
|
|
32
|
+
hierarchies. For information about managing projects, project
|
|
33
|
+
hierarchies, and permissions, see
|
|
34
|
+
https://help.tableau.com/current/server/en-us/projects.htm
|
|
35
|
+
|
|
36
|
+
samples : bool
|
|
37
|
+
Set to True to include sample workbooks and data sources in the
|
|
38
|
+
project. The default is False.
|
|
39
|
+
|
|
40
|
+
Attributes
|
|
41
|
+
----------
|
|
42
|
+
id : str
|
|
43
|
+
The unique identifier for the project.
|
|
44
|
+
|
|
45
|
+
owner_id : str
|
|
46
|
+
The unique identifier for the UserItem owner of the project.
|
|
47
|
+
|
|
48
|
+
"""
|
|
49
|
+
|
|
12
50
|
ERROR_MSG = "Project item must be populated with permissions first."
|
|
13
51
|
|
|
14
52
|
class ContentPermissions:
|
|
@@ -174,7 +212,7 @@ class ProjectItem:
|
|
|
174
212
|
self._permissions = permissions
|
|
175
213
|
|
|
176
214
|
def _set_default_permissions(self, permissions, content_type):
|
|
177
|
-
attr = f"_default_{content_type}_permissions"
|
|
215
|
+
attr = f"_default_{content_type}_permissions".lower()
|
|
178
216
|
setattr(
|
|
179
217
|
self,
|
|
180
218
|
attr,
|
|
@@ -9,6 +9,36 @@ from tableauserverclient.models.target import Target
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class TaskItem:
|
|
12
|
+
"""
|
|
13
|
+
Represents a task item in Tableau Server. To create new tasks, see Schedules.
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
id_ : str
|
|
18
|
+
The ID of the task.
|
|
19
|
+
|
|
20
|
+
task_type : str
|
|
21
|
+
Type of task. See TaskItem.Type for possible values.
|
|
22
|
+
|
|
23
|
+
priority : int
|
|
24
|
+
The priority of the task on the server.
|
|
25
|
+
|
|
26
|
+
consecutive_failed_count : int
|
|
27
|
+
The number of consecutive times the task has failed.
|
|
28
|
+
|
|
29
|
+
schedule_id : str, optional
|
|
30
|
+
The ID of the schedule that the task is associated with.
|
|
31
|
+
|
|
32
|
+
schedule_item : ScheduleItem, optional
|
|
33
|
+
The schedule item that the task is associated with.
|
|
34
|
+
|
|
35
|
+
last_run_at : datetime, optional
|
|
36
|
+
The last time the task was run.
|
|
37
|
+
|
|
38
|
+
target : Target, optional
|
|
39
|
+
The target of the task. This can be a workbook or a datasource.
|
|
40
|
+
"""
|
|
41
|
+
|
|
12
42
|
class Type:
|
|
13
43
|
ExtractRefresh = "extractRefresh"
|
|
14
44
|
DataAcceleration = "dataAcceleration"
|
|
@@ -7,12 +7,64 @@ from collections.abc import Iterator
|
|
|
7
7
|
from defusedxml.ElementTree import fromstring
|
|
8
8
|
|
|
9
9
|
from tableauserverclient.datetime_helpers import parse_datetime
|
|
10
|
-
from .exceptions import UnpopulatedPropertyError
|
|
11
|
-
from .permissions_item import PermissionsRule
|
|
12
|
-
from .tag_item import TagItem
|
|
10
|
+
from tableauserverclient.models.exceptions import UnpopulatedPropertyError
|
|
11
|
+
from tableauserverclient.models.permissions_item import PermissionsRule
|
|
12
|
+
from tableauserverclient.models.tag_item import TagItem
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class ViewItem:
|
|
16
|
+
"""
|
|
17
|
+
Contains the members or attributes for the view resources on Tableau Server.
|
|
18
|
+
The ViewItem class defines the information you can request or query from
|
|
19
|
+
Tableau Server. The class members correspond to the attributes of a server
|
|
20
|
+
request or response payload.
|
|
21
|
+
|
|
22
|
+
Attributes
|
|
23
|
+
----------
|
|
24
|
+
content_url: Optional[str], default None
|
|
25
|
+
The name of the view as it would appear in a URL.
|
|
26
|
+
|
|
27
|
+
created_at: Optional[datetime], default None
|
|
28
|
+
The date and time when the view was created.
|
|
29
|
+
|
|
30
|
+
id: Optional[str], default None
|
|
31
|
+
The unique identifier for the view.
|
|
32
|
+
|
|
33
|
+
image: Optional[Callable[[], bytes]], default None
|
|
34
|
+
The image of the view. You must first call the `views.populate_image`
|
|
35
|
+
method to access the image.
|
|
36
|
+
|
|
37
|
+
name: Optional[str], default None
|
|
38
|
+
The name of the view.
|
|
39
|
+
|
|
40
|
+
owner_id: Optional[str], default None
|
|
41
|
+
The ID for the owner of the view.
|
|
42
|
+
|
|
43
|
+
pdf: Optional[Callable[[], bytes]], default None
|
|
44
|
+
The PDF of the view. You must first call the `views.populate_pdf`
|
|
45
|
+
method to access the PDF.
|
|
46
|
+
|
|
47
|
+
preview_image: Optional[Callable[[], bytes]], default None
|
|
48
|
+
The preview image of the view. You must first call the
|
|
49
|
+
`views.populate_preview_image` method to access the preview image.
|
|
50
|
+
|
|
51
|
+
project_id: Optional[str], default None
|
|
52
|
+
The ID for the project that contains the view.
|
|
53
|
+
|
|
54
|
+
tags: set[str], default set()
|
|
55
|
+
The tags associated with the view.
|
|
56
|
+
|
|
57
|
+
total_views: Optional[int], default None
|
|
58
|
+
The total number of views for the view.
|
|
59
|
+
|
|
60
|
+
updated_at: Optional[datetime], default None
|
|
61
|
+
The date and time when the view was last updated.
|
|
62
|
+
|
|
63
|
+
workbook_id: Optional[str], default None
|
|
64
|
+
The ID for the workbook that contains the view.
|
|
65
|
+
|
|
66
|
+
"""
|
|
67
|
+
|
|
16
68
|
def __init__(self) -> None:
|
|
17
69
|
self._content_url: Optional[str] = None
|
|
18
70
|
self._created_at: Optional[datetime] = None
|
|
@@ -14,6 +14,39 @@ def _parse_event(events):
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class WebhookItem:
|
|
17
|
+
"""
|
|
18
|
+
The WebhookItem represents the webhook resources on Tableau Server or
|
|
19
|
+
Tableau Cloud. This is the information that can be sent or returned in
|
|
20
|
+
response to a REST API request for webhooks.
|
|
21
|
+
|
|
22
|
+
Attributes
|
|
23
|
+
----------
|
|
24
|
+
id : Optional[str]
|
|
25
|
+
The identifier (luid) for the webhook. You need this value to query a
|
|
26
|
+
specific webhook with the get_by_id method or to delete a webhook with
|
|
27
|
+
the delete method.
|
|
28
|
+
|
|
29
|
+
name : Optional[str]
|
|
30
|
+
The name of the webhook. You must specify this when you create an
|
|
31
|
+
instance of the WebhookItem.
|
|
32
|
+
|
|
33
|
+
url : Optional[str]
|
|
34
|
+
The destination URL for the webhook. The webhook destination URL must
|
|
35
|
+
be https and have a valid certificate. You must specify this when you
|
|
36
|
+
create an instance of the WebhookItem.
|
|
37
|
+
|
|
38
|
+
event : Optional[str]
|
|
39
|
+
The name of the Tableau event that triggers your webhook.This is either
|
|
40
|
+
api-event-name or webhook-source-api-event-name: one of these is
|
|
41
|
+
required to create an instance of the WebhookItem. We recommend using
|
|
42
|
+
the api-event-name. The event name must be one of the supported events
|
|
43
|
+
listed in the Trigger Events table.
|
|
44
|
+
https://help.tableau.com/current/developer/webhooks/en-us/docs/webhooks-events-payload.html
|
|
45
|
+
|
|
46
|
+
owner_id : Optional[str]
|
|
47
|
+
The identifier (luid) of the user who owns the webhook.
|
|
48
|
+
"""
|
|
49
|
+
|
|
17
50
|
def __init__(self):
|
|
18
51
|
self._id: Optional[str] = None
|
|
19
52
|
self.name: Optional[str] = None
|
|
@@ -99,7 +99,14 @@ class WorkbookItem:
|
|
|
99
99
|
>>> new_workbook = TSC.WorkbookItem('3a8b6148-493c-11e6-a621-6f3499394a39')
|
|
100
100
|
"""
|
|
101
101
|
|
|
102
|
-
def __init__(
|
|
102
|
+
def __init__(
|
|
103
|
+
self,
|
|
104
|
+
project_id: Optional[str] = None,
|
|
105
|
+
name: Optional[str] = None,
|
|
106
|
+
show_tabs: bool = False,
|
|
107
|
+
thumbnails_user_id: Optional[str] = None,
|
|
108
|
+
thumbnails_group_id: Optional[str] = None,
|
|
109
|
+
) -> None:
|
|
103
110
|
self._connections = None
|
|
104
111
|
self._content_url = None
|
|
105
112
|
self._webpage_url = None
|
|
@@ -130,6 +137,8 @@ class WorkbookItem:
|
|
|
130
137
|
}
|
|
131
138
|
self.data_freshness_policy = None
|
|
132
139
|
self._permissions = None
|
|
140
|
+
self.thumbnails_user_id = thumbnails_user_id
|
|
141
|
+
self.thumbnails_group_id = thumbnails_group_id
|
|
133
142
|
|
|
134
143
|
return None
|
|
135
144
|
|
|
@@ -275,6 +284,22 @@ class WorkbookItem:
|
|
|
275
284
|
raise UnpopulatedPropertyError(error)
|
|
276
285
|
return self._revisions()
|
|
277
286
|
|
|
287
|
+
@property
|
|
288
|
+
def thumbnails_user_id(self) -> Optional[str]:
|
|
289
|
+
return self._thumbnails_user_id
|
|
290
|
+
|
|
291
|
+
@thumbnails_user_id.setter
|
|
292
|
+
def thumbnails_user_id(self, value: str):
|
|
293
|
+
self._thumbnails_user_id = value
|
|
294
|
+
|
|
295
|
+
@property
|
|
296
|
+
def thumbnails_group_id(self) -> Optional[str]:
|
|
297
|
+
return self._thumbnails_group_id
|
|
298
|
+
|
|
299
|
+
@thumbnails_group_id.setter
|
|
300
|
+
def thumbnails_group_id(self, value: str):
|
|
301
|
+
self._thumbnails_group_id = value
|
|
302
|
+
|
|
278
303
|
def _set_connections(self, connections):
|
|
279
304
|
self._connections = connections
|
|
280
305
|
|
|
@@ -84,9 +84,10 @@ class Auth(Endpoint):
|
|
|
84
84
|
self._check_status(server_response, url)
|
|
85
85
|
parsed_response = fromstring(server_response.content)
|
|
86
86
|
site_id = parsed_response.find(".//t:site", namespaces=self.parent_srv.namespace).get("id", None)
|
|
87
|
+
site_url = parsed_response.find(".//t:site", namespaces=self.parent_srv.namespace).get("contentUrl", None)
|
|
87
88
|
user_id = parsed_response.find(".//t:user", namespaces=self.parent_srv.namespace).get("id", None)
|
|
88
89
|
auth_token = parsed_response.find("t:credentials", namespaces=self.parent_srv.namespace).get("token", None)
|
|
89
|
-
self.parent_srv._set_auth(site_id, user_id, auth_token)
|
|
90
|
+
self.parent_srv._set_auth(site_id, user_id, auth_token, site_url)
|
|
90
91
|
logger.info(f"Signed into {self.parent_srv.server_address} as user with id {user_id}")
|
|
91
92
|
return Auth.contextmgr(self.sign_out)
|
|
92
93
|
|
|
@@ -155,9 +156,10 @@ class Auth(Endpoint):
|
|
|
155
156
|
self._check_status(server_response, url)
|
|
156
157
|
parsed_response = fromstring(server_response.content)
|
|
157
158
|
site_id = parsed_response.find(".//t:site", namespaces=self.parent_srv.namespace).get("id", None)
|
|
159
|
+
site_url = parsed_response.find(".//t:site", namespaces=self.parent_srv.namespace).get("contentUrl", None)
|
|
158
160
|
user_id = parsed_response.find(".//t:user", namespaces=self.parent_srv.namespace).get("id", None)
|
|
159
161
|
auth_token = parsed_response.find("t:credentials", namespaces=self.parent_srv.namespace).get("token", None)
|
|
160
|
-
self.parent_srv._set_auth(site_id, user_id, auth_token)
|
|
162
|
+
self.parent_srv._set_auth(site_id, user_id, auth_token, site_url)
|
|
161
163
|
logger.info(f"Signed into {self.parent_srv.server_address} as user with id {user_id}")
|
|
162
164
|
return Auth.contextmgr(self.sign_out)
|
|
163
165
|
|