Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableauHTTP#get_trusted_ticket_for_user doesn't work correctly #100

Open
miau opened this issue Aug 28, 2020 · 0 comments
Open

TableauHTTP#get_trusted_ticket_for_user doesn't work correctly #100

miau opened this issue Aug 28, 2020 · 0 comments

Comments

@miau
Copy link

miau commented Aug 28, 2020

TableauHTTP#get_trusted_ticket_for_user fails when I pass the correct username.

Passing data in str to requests.post results in no Content-Type header. When you pass data in dict, Content-Type: header is set to application/x-www-form-urlencoded and Tableau Server parses this request correctly.

https://github.com/bryantbhowell/tableau_tools/blob/f04234ef93109543025f990f6e79f8da6f567b05/tableau_http.py#L15
These lines

        post_data = "username={}".format(username)
        if site.lower() != 'default':
            post_data += "&target_site={}".format(site)
        if client_ip is not None:
            post_data += "&client_id={}".format(client_ip)
        response = self.session.post(trusted_url, data=post_data)

should be:

        post_data = {"username": username}
        if site.lower() != 'default':
            post_data["target_site"] = site
        if client_ip is not None:
            post_data["client_id"] = client_ip
        response = self.session.post(trusted_url, data=post_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant