bryanthowell-tableau / tableau_tools

Package containing Tableau REST API, XML modification, tabcmd and repository tools
Other
215 stars 87 forks source link

TableauHTTP#get_trusted_ticket_for_user should raise an exception if it fails #99

Open miau opened 4 years ago

miau commented 4 years ago

TableauHTTP#get_trusted_ticket_for_user doesn't raise an exception when the response.content == b'-1'.

https://github.com/bryantbhowell/tableau_tools/blob/f04234ef93109543025f990f6e79f8da6f567b05/tableau_http.py#L22

should be:

        ticket = response.content
        if ticket == b'-1' or not ticket:
            raise NoResultsException('Ticket generation was not complete (returned "-1"), check Tableau Server trusted authorization configurations')
        else:
            return ticket

or (when you expect this method to return str):

        ticket = response.content.decode()
        if ticket == '-1' or not ticket:
            raise NoResultsException('Ticket generation was not complete (returned "-1"), check Tableau Server trusted authorization configurations')
        else:
            return ticket