Tableau Server: Testing Trusted Authentication Ticket Retrieval From The Command Line with Python

Version 4

    This is provided without warranty or promise of support. Please note that the following assumes that Trusted Authentication has already been configured on Tableau Server (Configure Trusted Authentication).


    Need to test Trusted Authentication (trusted tickets) from your web server, but can't easily access the web ticket tester example because your web server has no GUI?


    Here is a way to quickly test trusted authentication ticket generation on Tableau Server using Python and the Requests library:


    Tableau Server With SSL:

    import requests
    r ='https://<TableauServerURL>/trusted/', data={"username": "<YourUsernameHere>"}, verify='C:\certs\<YourCertificateHere>')
    print(r.status_code, r.reason)
    print r.text


    Tableau Server Without SSL:

    import requests
    r ='http://<TableauServerURL>/trusted/', data={"username": "<YourUsernameHere>"})
    print(r.status_code, r.reason)
    print r.text


    If the ticket test is successful, you will see a ticket returned like:



    If the ticket test is not successful, you will see:



    Example of successful & failed ticket requests:



    If a ticket is successfully generated, it can be tested with a URL as outlined here in step 5:

    Testing Trusted Authentication


    Troubleshooting and additional information regarding testing Trusted Authentication can be found here:

    Ticket Value of -1 Returned from Tableau Server