-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #507 from tableau/development
Release v0.9 ## 0.9 (4 Oct 2019) * Added Metadata API endpoints (#431) * Added site settings for Data Catalog and Prep Conductor (#434) * Added new fields to ViewItem (#331) * Added support and samples for Tableau Server Personal Access Tokens (#465) * Added Permissions endpoints (#429) * Added tags to ViewItem (#470) * Added Databases and Tables endpoints (#445) * Added Flow endpoints (#494) * Added ability to filter projects by topLevelProject attribute (#497) * Improved server_info endpoint error handling (#439) * Improved Pager to take in keyword arguments (#451) * Fixed UUID serialization error while publishing workbook (#449) * Fixed materalized views in request body for update_workbook (#461)
- Loading branch information
Showing
72 changed files
with
2,771 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#### | ||
# This script demonstrates how to log in to Tableau Server Client. | ||
# | ||
# To run the script, you must have installed Python 2.7.9 or later. | ||
#### | ||
|
||
import argparse | ||
import getpass | ||
import logging | ||
|
||
import tableauserverclient as TSC | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Logs in to the server.') | ||
|
||
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error', | ||
help='desired logging level (set to error by default)') | ||
|
||
parser.add_argument('--server', '-s', required=True, help='server address') | ||
|
||
group = parser.add_mutually_exclusive_group(required=True) | ||
group.add_argument('--username', '-u', help='username to sign into the server') | ||
group.add_argument('--token-name', '-n', help='name of the personal access token used to sign into the server') | ||
|
||
args = parser.parse_args() | ||
|
||
# Set logging level based on user input, or error by default. | ||
logging_level = getattr(logging, args.logging_level.upper()) | ||
logging.basicConfig(level=logging_level) | ||
|
||
# Make sure we use an updated version of the rest apis. | ||
server = TSC.Server(args.server, use_server_version=True) | ||
|
||
if args.username: | ||
# Trying to authenticate using username and password. | ||
password = getpass.getpass("Password: ") | ||
tableau_auth = TSC.TableauAuth(args.username, password) | ||
with server.auth.sign_in(tableau_auth): | ||
print('Logged in successfully') | ||
|
||
else: | ||
# Trying to authenticate using personal access tokens. | ||
personal_access_token = getpass.getpass("Personal Access Token: ") | ||
tableau_auth = TSC.PersonalAccessTokenAuth(token_name=args.token_name, | ||
personal_access_token=personal_access_token) | ||
with server.auth.sign_in_with_personal_access_token(tableau_auth): | ||
print('Logged in successfully') | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import xml.etree.ElementTree as ET | ||
|
||
from .property_decorators import property_is_enum, property_not_empty | ||
from .exceptions import UnpopulatedPropertyError | ||
|
||
|
||
class ColumnItem(object): | ||
def __init__(self, name, description=None): | ||
self._id = None | ||
self.description = description | ||
self.name = name | ||
|
||
@property | ||
def id(self): | ||
return self._id | ||
|
||
@property | ||
def name(self): | ||
return self._name | ||
|
||
@name.setter | ||
@property_not_empty | ||
def name(self, value): | ||
self._name = value | ||
|
||
@property | ||
def description(self): | ||
return self._description | ||
|
||
@description.setter | ||
def description(self, value): | ||
self._description = value | ||
|
||
@property | ||
def remote_type(self): | ||
return self._remote_type | ||
|
||
def _set_values(self, id, name, description, remote_type): | ||
if id is not None: | ||
self._id = id | ||
if name: | ||
self._name = name | ||
if description: | ||
self.description = description | ||
if remote_type: | ||
self._remote_type = remote_type | ||
|
||
@classmethod | ||
def from_response(cls, resp, ns): | ||
all_column_items = list() | ||
parsed_response = ET.fromstring(resp) | ||
all_column_xml = parsed_response.findall('.//t:column', namespaces=ns) | ||
|
||
for column_xml in all_column_xml: | ||
(id, name, description, remote_type) = cls._parse_element(column_xml, ns) | ||
column_item = cls(name) | ||
column_item._set_values(id, name, description, remote_type) | ||
all_column_items.append(column_item) | ||
|
||
return all_column_items | ||
|
||
@staticmethod | ||
def _parse_element(column_xml, ns): | ||
id = column_xml.get('id', None) | ||
name = column_xml.get('name', None) | ||
description = column_xml.get('description', None) | ||
remote_type = column_xml.get('remoteType', None) | ||
|
||
return id, name, description, remote_type |
Oops, something went wrong.