Skip to content

Commit 1eeaca8

Browse files
authored
Prepare release 0.19 (#1049)
* Add new samples and delete redundant ones * Clean up hidden_views by making it an attribute of WorkbookItem * Add type hints for workbook and data source revisions, data alerts, Favorites, Flows, groups, permissions, projects, flow runs, site, subscriptions, Users, webhooks * add get_by_id method and test for schedules * Allow null value for user quota tiers * fix workbook.delete_extract * add publish to pypi action fix xml generation for items * Add Status, ParentProjectId and StartedAt filters for jobs endpoint * make project_id nullable to support "Personal Space" for workbooks * create single Credentials class * Reassign content on user removal * add redaction method to remove passwords when logging requests and responses, which can contain embedded credentials. * remove support for python 3.6 (add python version enforcement in setup.py) * Extract refreshable item IDs from job XML response * Do not eagerly fetch content when a stream was requested * Fix QuerySet slicing logic * add CRUD methods for default permissions * refactor Resource Types and add sample code
1 parent b9a10fd commit 1eeaca8

Some content is hidden

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

74 files changed

+789
-418
lines changed

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
fail-fast: false
99
matrix:
1010
os: [ubuntu-latest, macos-latest, windows-latest]
11-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
11+
python-version: ['3.7', '3.8', '3.9', '3.10']
1212

1313
runs-on: ${{ matrix.os }}
1414

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ target/
7878

7979
# poetry
8080
poetry.lock
81-
pyproject.toml
8281

8382
# celery beat schedule file
8483
celerybeat-schedule

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Use the Tableau Server Client (TSC) library to increase your productivity as you
88
* Create users and groups.
99
* Query projects, sites, and more.
1010

11-
This repository contains Python source code for the library and sample files showing how to use it. Python versions 3.6 and up are supported.
11+
This repository contains Python source code for the library and sample files showing how to use it. As of May 2022, Python versions 3.7 and up are supported.
1212

1313
To see sample code that works directly with the REST API (in Java, Python, or Postman), visit the [REST API Samples](https://github.com/tableau/rest-api-samples) repo.
1414

publish.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/usr/bin/env bash
22

3+
# tag the release version and confirm a clean version number
4+
git tag vxxxx
5+
git describe --tag --dirty --always
6+
37
set -e
48

59
rm -rf dist
6-
python3 setup.py sdist
7-
python3 setup.py bdist_wheel
10+
python setup.py sdist bdist_wheel
811
twine upload dist/*

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[build-system]
2+
requires = ["setuptools>=45.0", "versioneer-518", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.black]
6+
line-length = 120
7+
target-version = ['py37', 'py38', 'py39', 'py310']
8+
9+
[tool.mypy]
10+
disable_error_code = [
11+
'misc',
12+
'import'
13+
]
14+
files = [
15+
"tableauserverclient",
16+
"test"
17+
]
18+
show_error_codes = true

samples/add_default_permission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
####
22
# This script demonstrates how to add default permissions using TSC
3-
# To run the script, you must have installed Python 3.6 or later.
3+
# To run the script, you must have installed Python 3.7 or later.
44
#
55
# In order to demonstrate adding a new default permission, this sample will create
66
# a new project and add a new capability to the new project, for the default "All users" group.

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 a group using the Tableau
33
# Server Client.
44
#
5-
# To run the script, you must have installed Python 3.6 or later.
5+
# To run the script, you must have installed Python 3.7 or later.
66
####
77

88

samples/create_project.py

Lines changed: 20 additions & 3 deletions
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 3.6 or later.
7+
# To run the script, you must have installed Python 3.7 or later.
88
####
99

1010
import argparse
@@ -21,7 +21,8 @@ def create_project(server, project_item, samples=False):
2121
return project_item
2222
except TSC.ServerResponseError:
2323
print("We have already created this project: %s" % project_item.name)
24-
sys.exit(1)
24+
project_items = server.projects.filter(name=project_item.name)
25+
return project_items[0]
2526

2627

2728
def main():
@@ -52,7 +53,8 @@ def main():
5253
logging.basicConfig(level=logging_level)
5354

5455
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
55-
server = TSC.Server(args.server)
56+
server = TSC.Server(args.server, http_options={"verify": False})
57+
5658
server.use_server_version()
5759
with server.auth.sign_in(tableau_auth):
5860
# Use highest Server REST API version available
@@ -73,6 +75,21 @@ def main():
7375
# Projects can be updated
7476
changed_project = server.projects.update(grand_child_project, samples=True)
7577

78+
server.projects.populate_workbook_default_permissions(changed_project),
79+
server.projects.populate_flow_default_permissions(changed_project),
80+
server.projects.populate_lens_default_permissions(changed_project), # uses same as workbook
81+
server.projects.populate_datasource_default_permissions(changed_project),
82+
server.projects.populate_permissions(changed_project)
83+
# Projects have default permissions set for the object types they contain
84+
print("Permissions from project {}:".format(changed_project.id))
85+
print(changed_project.permissions)
86+
print(
87+
changed_project.default_workbook_permissions,
88+
changed_project.default_datasource_permissions,
89+
changed_project.default_lens_permissions,
90+
changed_project.default_flow_permissions,
91+
)
92+
7693

7794
if __name__ == "__main__":
7895
main()

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 3.6 or later.
5+
# To run the script, you must have installed Python 3.7 or later.
66
####
77

88

samples/download_view_image.py

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)