8000 Merge branch 'development' into metadata/parameters · gentleway/server-client-python@78c34f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 78c34f8

Browse files
authored
Merge branch 'development' into metadata/parameters
2 parents 1a25f5c + 6547f6b commit 78c34f8

Some content is hidden

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

41 files changed

+414
-322
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.5, 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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 0.16.0 (15 July 2021)
2+
* Documentation updates (#800, #818, #839, #842)
3+
* Fixed data alert repr in subscription item (#821)
4+
* Added support for Data Quality Warning (#836)
5+
* Added support for renaming datasources (#843)
6+
* Improved Datasource tests (#843)
7+
* Updated catalog obfuscation field (#844)
8+
* Fixed revision limit field in site_item.py file (#847)
9+
* Added the Missing content permission field- LockedToProjectWithoutNested (#856)
10+
111
## 0.15.0 (16 Feb 2021)
212
* Added support for python version 3.9 (#744)
313
* Added support for 'Get View by ID' (#750)

CONTRIBUTORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The following people have contributed to this project to make it possible, and w
4444
* [Terrence Jones](https://github.com/tjones-commits)
4545
* [John Vandenberg](https://github.com/jayvdb)
4646
* [Lee Boynton](https://github.com/lboynton)
47+
* [annematronic](https://github.com/annematronic)
4748

4849
## Core Team
4950

@@ -57,3 +58,4 @@ The following people have contributed to this project to make it possible, and w
5758
* [Jac Fitzgerald](https://github.com/jacalata)
5859
* [Dan Zucker](https://github.com/dzucker-tab)
5960
* [Brian Cantoni](https://github.com/bcantoni)
61+
* [Ovini Nanayakkara](https://github.com/ovinis)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ This repository contains Python source code and sample files. Python versions 3.
1212

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

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: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
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: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
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: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
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: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
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()

samples/explore_webhooks.py

Lines changed: 11 additions & 19 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
import os.path
1615

@@ -20,35 +19,28 @@
2019
def main():
2120

2221
parser = argparse.ArgumentParser(description='Explore webhook functions supported by the Server API.')
22+
# Common options; please keep those in sync across all samples
2323
parser.add_argument('--server', '-s', required=True, help='server address')
24-
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
25-
parser.add_argument('--site', '-S', default=None)
26-
parser.add_argument('-p', default=None, help='password')
27-
parser.add_argument('--create', '-c', help='create a webhook')
28-
parser.add_argument('--delete', '-d', help='delete a webhook', action='store_true')
24+
parser.add_argument('--site', '-S', help='site name')
25+
parser.add_argument('--token-name', '-p', required=True,
26+
help='name of the personal access token used to sign into the server')
27+
parser.add_argument('--token-value', '-v', required=True,
28+
help='value of the personal access token used to sign into the server')
2929
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
3030
help='desired logging level (set to error by default)')
31+
# Options specific to this sample
32+
parser.add_argument('--create', help='create a webhook')
33+
parser.add_argument('--delete', help='delete a webhook', action='store_true')
3134

3235
args = parser.parse_args()
33-
if args.p is None:
34-
password = getpass.getpass("Password: ")
35-
else:
36-
password = args.p
3736

3837
# Set logging level based on user input, or error by default
3938
logging_level = getattr(logging, args.logging_level.upper())
4039
logging.basicConfig(level=logging_level)
4140

4241
# SIGN IN
43-
tableau_auth = TSC.TableauAuth(args.username, password, args.site)
44-
print("Signing in to " + args.server + " [" + args.site + "] as " + args.username)
45-
server = TSC.Server(args.server)
46-
47-
# Set http options to disable verifying SSL
48-
server.add_http_options({'verify': False})
49-
50-
server.use_server_version()
51-
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)
5244
with server.auth.sign_in(tableau_auth):
5345

5446
# Create webhook if create flag is set (-create, -c)

0 commit comments

Comments
 (0)
0