Last active
September 23, 2020 16:01
-
-
Save jfreels/b76090ac7e5edd686433d40b79c87642 to your computer and use it in GitHub Desktop.
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
import sys | |
import tableauserverclient as tsc | |
TABLEAU_CREDENTIALS = { | |
"server_url": "", | |
"username": "", | |
"password": "", | |
"site": "" | |
} | |
def main(): | |
# authentication | |
server_url = TABLEAU_CREDENTIALS["server_url"] | |
site = TABLEAU_CREDENTIALS["site"] | |
tableau_auth = tsc.TableauAuth( | |
TABLEAU_CREDENTIALS["username"], | |
TABLEAU_CREDENTIALS["password"], | |
site_id=site | |
) | |
server = tsc.Server(server_url) | |
server.use_server_version() | |
print(f"Tableau Server: {server_url}") | |
print(f"Tableau Server Site: {site}") | |
print("Users: ") | |
# sign in | |
with server.auth.sign_in(tableau_auth): | |
# get users on site | |
users, pagination_item = server.users.get() | |
for user in users: | |
print(f"{user.name}, {user.id}") | |
if __name__ == "__main__": | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment