3 Replies Latest reply on Oct 2, 2018 9:46 AM by Saket Krishna

    Calling Signin API using Python

    Saket Krishna



      I have below code written in python to signin tableau server but it is giving error(Screen attached). could anyone let me know what i am doing wrong and how to correct it to make this working.


      import requests

      from urllib2 import urlopen, Request

      import xml.etree.ElementTree as ET


      server_name = "myserver"

      user_name = "user"

      password = "pass"

      site = "EBS"

      api_ver = "2.3"

      signin_url = "http://{0}/api/{1}/auth/signin".format(server_name,api_ver)


      req_xml = ET.Element('tsRequest')

      credentials = ET.SubElement(req_xml,'credentials', name = user_name, password = pass )

      site = ET.SubElement(req_xml,'site', contentUrl = site)

      xdata = ET.tostring(req_xml)

      print("*********************** Request Body ************************")



      req = Request(signin_url, xdata)

      print("*********************** Request Body ************************")

      req = urlopen(req)