This repository was archived by the owner on Nov 2, 2020. It is now read-only.
forked from tableau/server-client-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_group.py
More file actions
42 lines (30 loc) · 1.26 KB
/
create_group.py
File metadata and controls
42 lines (30 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
####
# This script demonstrates how to create groups using the Tableau
# Server Client.
#
# To run the script, you must have installed Python 2.7.9 or later.
####
import argparse
import getpass
import logging
from datetime import time
import tableauserverclient as TSC
def main():
parser = argparse.ArgumentParser(description='Creates sample schedules for each type of frequency.')
parser.add_argument('--server', '-s', required=True, help='server address')
parser.add_argument('--username', '-u', required=True, help='username to sign into server')
parser.add_argument('--logging-level', '-l', choices=['debug', 'info', 'error'], default='error',
help='desired logging level (set to error by default)')
args = parser.parse_args()
password = getpass.getpass("Password: ")
# Set logging level based on user input, or error by default
logging_level = getattr(logging, args.logging_level.upper())
logging.basicConfig(level=logging_level)
tableau_auth = TSC.TableauAuth(args.username, password)
server = TSC.Server(args.server)
with server.auth.sign_in(tableau_auth):
group = TSC.GroupItem('test')
group = server.groups.create(group)
print(group)
if __name__ == '__main__':
main()