Skip to content

Commit f81039a

Browse files
Merge pull request #921 from tableau/development
Merging Development to Main branch for releasing v 0.17
2 parents fefd6f1 + 46bbe2e commit f81039a

File tree

76 files changed

+1360
-424
lines changed

Some content is hidden

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

76 files changed

+1360
-424
lines changed

.github/workflows/run-tests.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
name: Python package
1+
name: Python tests
22

33
on: [push]
44

55
jobs:
66
build:
7-
8-
runs-on: ubuntu-latest
97
strategy:
108
fail-fast: false
119
matrix:
12-
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
10+
os: [ubuntu-latest, macos-latest, windows-latest]
11+
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0-rc.2]
12+
13+
runs-on: ${{ matrix.os }}
1314

1415
steps:
1516
- uses: actions/checkout@v2
1617

17-
- name: Set up Python ${{ matrix.python-version }}
18+
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
1819
uses: actions/setup-python@v2
1920
with:
2021
python-version: ${{ matrix.python-version }}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 0.17.0 (20 October 2021)
2+
Update publish.sh to use python3 (#866)
3+
Fixed jobs.get_by_id(job_id) example & reference docs (#867, #868)
4+
Fixed handling for workbooks in personal spaces which do not have projectID or Name (#875)
5+
Updated links to Data Source Methods page in REST API docs (#879)
6+
Upgraded to newer Slack action provider (#880)
7+
Added support to the package for getting flow run status, as well as the ability to cancel flow runs. (#884)
8+
19
## 0.16.0 (15 July 2021)
210
* Documentation updates (#800, #818, #839, #842)
311
* Fixed data alert repr in subscription item (#821)

CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ The following people have contributed to this project to make it possible, and w
5959
* [Dan Zucker](https://github.com/dzucker-tab)
6060
* [Brian Cantoni](https://github.com/bcantoni)
6161
* [Ovini Nanayakkara](https://github.com/ovinis)
62+
* [Manish Muttreja](https://github.com/mmuttreja-tableau)

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 and sample files. Python versions 3.5 and up are supported.
11+
This repository contains Python source code and sample files. Python versions 3.6 and up are supported.
1212

1313
For more information on installing and using TSC, see the documentation:
1414
<https://tableau.github.io/server-client-python/docs/>

publish.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
set -e
44

55
rm -rf dist
6-
python setup.py sdist
7-
python setup.py bdist_wheel
6+
python3 setup.py sdist
87
python3 setup.py bdist_wheel
98
twine upload dist/*

samples/add_default_permission.py

Lines changed: 12 additions & 14 deletions
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.5 and later.
3+
# To run the script, you must have installed Python 3.6 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.
@@ -10,35 +10,33 @@
1010
####
1111

1212
import argparse
13-
import getpass
1413
import logging
1514

1615
import tableauserverclient as TSC
1716

1817

1918
def main():
2019
parser = argparse.ArgumentParser(description='Add workbook default permissions for a given project.')
21-
parser.add_argument('--server', '-s', required=True, help='Server address')
22-
parser.add_argument('--username', '-u', required=True, help='Username to sign into server')
23-
parser.add_argument('--site', '-S', default=None, help='Site to sign into - default site if not provided')
24-
parser.add_argument('-p', default=None, help='Password to sign into server')
25-
20+
# Common options; please keep those in sync across all samples
21+
parser.add_argument('--server', '-s', required=True, help='server address')
22+
parser.add_argument('--site', '-S', help='site name')
23+
parser.add_argument('--token-name', '-p', required=True,
24+
help='name of the personal access token used to sign into the server')
25+
parser.add_argument('--token-value', '-v', required=True,
26+
help='value of the personal access token used to sign into the server')
2627
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
2728
help='desired logging level (set to error by default)')
29+
# Options specific to this sample
30+
# This sample has no additional options, yet. If you add some, please add them here
2831

2932
args = parser.parse_args()
3033

31-
if args.p is None:
32-
password = getpass.getpass("Password: ")
33-
else:
34-
password = args.p
35-
3634
# Set logging level based on user input, or error by default
3735
logging_level = getattr(logging, args.logging_level.upper())
3836
logging.basicConfig(level=logging_level)
3937

40-
# Sign in
41-
tableau_auth = TSC.TableauAuth(args.username, password, args.site)
38+
# Sign in to server
39+
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
4240
server = TSC.Server(args.server, use_server_version=True)
4341
with server.auth.sign_in(tableau_auth):
4442

samples/create_group.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
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.5 or later.
5+
# To run the script, you must have installed Python 3.6 or later.
66
####
77

88

99
import argparse
10-
import getpass
1110
import logging
1211

1312
from datetime import time
@@ -18,20 +17,26 @@
1817
def main():
1918

2019
parser = argparse.ArgumentParser(description='Creates a sample user group.')
20+
# Common options; please keep those in sync across all samples
2121
parser.add_argument('--server', '-s', required=True, help='server address')
22-
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
22+
parser.add_argument('--site', '-S', help='site name')
23+
parser.add_argument('--token-name', '-p', required=True,
24+
help='name of the personal access token used to sign into the server')
25+
parser.add_argument('--token-value', '-v', required=True,
26+
help='value of the personal access token used to sign into the server')
2327
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
2428
help='desired logging level (set to error by default)')
25-
args = parser.parse_args()
29+
# Options specific to this sample
30+
# This sample has no additional options, yet. If you add some, please add them here
2631

27-
password = getpass.getpass("Password: ")
32+
args = parser.parse_args()
2833

2934
# Set logging level based on user input, or error by default
3035
logging_level = getattr(logging, args.logging_level.upper())
3136
logging.basicConfig(level=logging_level)
3237

33-
tableau_auth = TSC.TableauAuth(args.username, password)
34-
server = TSC.Server(args.server)
38+
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
39+
server = TSC.Server(args.server, use_server_version=True)
3540
with server.auth.sign_in(tableau_auth):
3641
group = TSC.GroupItem('test')
3742
group = server.groups.create(group)

samples/create_project.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
# parent_id.
55
#
66
#
7-
# To run the script, you must have installed Python 3.5 or later.
7+
# To run the script, you must have installed Python 3.6 or later.
88
####
99

1010
import argparse
11-
import getpass
1211
import logging
1312
import sys
1413

@@ -27,28 +26,26 @@ def create_project(server, project_item):
2726

2827
def main():
2928
parser = argparse.ArgumentParser(description='Create new projects.')
29+
# Common options; please keep those in sync across all samples
3030
parser.add_argument('--server', '-s', required=True, help='server address')
31-
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
32-
parser.add_argument('--site', '-S', default=None)
33-
parser.add_argument('-p', default=None, help='password')
34-
31+
parser.add_argument('--site', '-S', help='site name')
32+
parser.add_argument('--token-name', '-p', required=True,
33+
help='name of the personal access token used to sign into the server')
34+
parser.add_argument('--token-value', '-v', required=True,
35+
help='value of the personal access token used to sign into the server')
3536
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
3637
help='desired logging level (set to error by default)')
38+
# Options specific to this sample
39+
# This sample has no additional options, yet. If you add some, please add them here
3740

3841
args = parser.parse_args()
3942

40-
if args.p is None:
41-
password = getpass.getpass("Password: ")
42-
else:
43-
password = args.p
44-
4543
# Set logging level based on user input, or error by default
4644
logging_level = getattr(logging, args.logging_level.upper())
4745
logging.basicConfig(level=logging_level)
4846

49-
tableau_auth = TSC.TableauAuth(args.username, password)
50-
server = TSC.Server(args.server)
51-
47+
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
48+
server = TSC.Server(args.server, use_server_version=True)
5249
with server.auth.sign_in(tableau_auth):
5350
# Use highest Server REST API version available
5451
server.use_server_version()

samples/create_schedules.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
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.5 or later.
5+
# To run the script, you must have installed Python 3.6 or later.
66
####
77

88

99
import argparse
10-
import getpass
1110
import logging
1211

1312
from datetime import time
@@ -18,20 +17,26 @@
1817
def main():
1918

2019
parser = argparse.ArgumentParser(description='Creates sample schedules for each type of frequency.')
20+
# Common options; please keep those in sync across all samples
2121
parser.add_argument('--server', '-s', required=True, help='server address')
22-
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
22+
parser.add_argument('--site', '-S', help='site name')
23+
parser.add_argument('--token-name', '-p', required=True,
24+
help='name of the personal access token used to sign into the server')
25+
parser.add_argument('--token-value', '-v', required=True,
26+
help='value of the personal access token used to sign into the server')
2327
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
2428
help='desired logging level (set to error by default)')
25-
args = parser.parse_args()
29+
# Options specific to this sample
30+
# This sample has no additional options, yet. If you add some, please add them here
2631

27-
password = getpass.getpass("Password: ")
32+
args = parser.parse_args()
2833

2934
# Set logging level based on user input, or error by default
3035
logging_level = getattr(logging, args.logging_level.upper())
3136
logging.basicConfig(level=logging_level)
3237

33-
tableau_auth = TSC.TableauAuth(args.username, password)
34-
server = TSC.Server(args.server)
38+
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
39+
server = TSC.Server(args.server, use_server_version=True)
3540
with server.auth.sign_in(tableau_auth):
3641
# Hourly Schedule
3742
# This schedule will run every 2 hours between 2:30AM and 11:00PM

samples/download_view_image.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
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 3.5 or later.
8+
# To run the script, you must have installed Python 3.6 or later.
99
####
1010

1111
import argparse
12-
import getpass
1312
import logging
1413

1514
import tableauserverclient as TSC
@@ -18,34 +17,30 @@
1817
def main():
1918

2019
parser = argparse.ArgumentParser(description='Download image of a specified view.')
20+
# Common options; please keep those in sync across all samples
2121
parser.add_argument('--server', '-s', required=True, help='server address')
22-
parser.add_argument('--site-id', '-si', required=False,
23-
help='content url for site the view is on')
24-
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
25-
parser.add_argument('--view-name', '-v', required=True,
22+
parser.add_argument('--site', '-S', help='site name')
23+
parser.add_argument('--token-name', '-p', required=True,
24+
help='name of the personal access token used to sign into the server')
25+
parser.add_argument('--token-value', '-v', required=True,
26+
help='value of the personal access token used to sign into the server')
27+
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
28+
help='desired logging level (set to error by default)')
29+
# Options specific to this sample
30+
parser.add_argument('--view-name', '-vn', required=True,
2631
help='name of view to download an image of')
2732
parser.add_argument('--filepath', '-f', required=True, help='filepath to save the image returned')
2833
parser.add_argument('--maxage', '-m', required=False, help='max age of the image in the cache in minutes.')
29-
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
30-
help='desired logging level (set to error by default)')
3134

3235
args = parser.parse_args()
3336

34-
password = getpass.getpass("Password: ")
35-
3637
# Set logging level based on user input, or error by default
3738
logging_level = getattr(logging, args.logging_level.upper())
3839
logging.basicConfig(level=logging_level)
3940

4041
# Step 1: Sign in to server.
41-
site_id = args.site_id
42-
if not site_id:
43-
site_id = ""
44-
tableau_auth = TSC.TableauAuth(args.username, password, site_id=site_id)
45-
server = TSC.Server(args.server)
46-
# The new endpoint was introduced in Version 2.5
47-
server.version = "2.5"
48-
42+
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
43+
server = TSC.Server(args.server, use_server_version=True)
4944
with server.auth.sign_in(tableau_auth):
5045
# Step 2: Query for the view that we want an image of
5146
req_option = TSC.RequestOptions()

samples/explore_datasource.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
####
1111

1212
import argparse
13-
import getpass
1413
import logging
1514

1615
import tableauserverclient as TSC
@@ -19,25 +18,28 @@
1918
def main():
2019

2120
parser = argparse.ArgumentParser(description='Explore datasource functions supported by the Server API.')
21+
# Common options; please keep those in sync across all samples
2222
parser.add_argument('--server', '-s', required=True, help='server address')
23-
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
24-
parser.add_argument('--publish', '-p', metavar='FILEPATH', help='path to datasource to publish')
25-
parser.add_argument('--download', '-d', metavar='FILEPATH', help='path to save downloaded datasource')
23+
parser.add_argument('--site', '-S', help='site name')
24+
parser.add_argument('--token-name', '-p', required=True,
25+
help='name of the personal access token used to sign into the server')
26+
parser.add_argument('--token-value', '-v', required=True,
27+
help='value of the personal access token used to sign into the server')
2628
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
2729
help='desired logging level (set to error by default)')
30+
# Options specific to this sample
31+
parser.add_argument('--publish', metavar='FILEPATH', help='path to datasource to publish')
32+
parser.add_argument('--download', metavar='FILEPATH', help='path to save downloaded datasource')
2833

2934
args = parser.parse_args()
3035

31-
password = getpass.getpass("Password: ")
32-
3336
# Set logging level based on user input, or error by default
3437
logging_level = getattr(logging, args.logging_level.upper())
3538
logging.basicConfig(level=logging_level)
3639

3740
# SIGN IN
38-
tableau_auth = TSC.TableauAuth(args.username, password)
39-
server = TSC.Server(args.server)
40-
server.use_highest_version()
41+
tableau_auth = TSC.PersonalAccessTokenAuth(args.token_name, args.token_value, site_id=args.site)
42+
server = TSC.Server(args.server, use_server_version=True)
4143
with server.auth.sign_in(tableau_auth):
4244
# Query projects for use when demonstrating publishing and updating
4345
all_projects, pagination_item = server.projects.get()

0 commit comments

Comments
 (0)