Skip to content

Instantly share code, notes, and snippets.

@jfreels
Last active September 23, 2020 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfreels/b76090ac7e5edd686433d40b79c87642 to your computer and use it in GitHub Desktop.
Save jfreels/b76090ac7e5edd686433d40b79c87642 to your computer and use it in GitHub Desktop.
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