title: Authenticate Tableau REST API using Python 2.7
body: <p>I'm having a similar issue to this recently answered question: <a href="https://stackoverflow.com/questions/42297545/authenticate-embed-tableau-rest-api-using-python-2-7">Authenticate &amp; Embed Tableau Rest API using python 2.7</a></p>
  
  <p>I'm using the same code, but getting a different error. Confirmed that I am calling the correct API version for my Tableau server version.</p>
  
  <pre><code>from urllib2 import urlopen, Request
  import xml.etree.ElementTree as ET # for parsing XML responses
  server_name = "http://dashboard.myorg.org"
  user_name = "abc"
  password = "abc"
  site_url_id = ""
  signin_url = "{server}/api/2.4/auth/signin".format(server=server_name)
  request_xml = ET.Element('tsRequest')
  credentials = ET.SubElement(request_xml, 'credentials',
                              name=user_name, password=password)
  site_element = ET.SubElement(credentials, 'site',
                               contentUrl=site_url_id)
  
  request_data = ET.tostring(request_xml)
  
  req = Request(signin_url, data=request_data)
  req = urlopen(req)
  
  server_response = req.read
  response_xml = ET.fromstring(server_response)
  token = response_xml.find('.//t:credentials',
                            namespaces={'t': "http://tableau.com/api"}).attrib['token']
  site_id = response_xml.find('.//t:site',
                            namespaces={'t': "http://tableau.com/api"}).attrib['id']
  print('Sign in successful!')
  print('/tToken: {token}'.format(token=token))
  print('/tSite ID: {site_id}'.format(site_id=site_id))
  headers = {'X-tableau-auth': token}
  signout_url = "{server}/api/2.4/auth/signout".format(server=server_name)
  req = Request(signout_url, headers=headers, data=b'')
  req = urlopen(req)
  print('Sign out successful!')
  </code></pre>
  
  <p>My error is:</p>
  
  <pre><code>Traceback (most recent call last):
    File "api_call.py", line 20, in &lt;module&gt;
      response_xml = ET.fromstring(server_response)
    File "C:\Python27\lib\xml\etree\ElementTree.py", line 1311, in XML
      parser.feed(text)
    File "C:\Python27\lib\xml\etree\ElementTree.py", line 1311, in feed
      self._parser.Parse(data, 0)
  TypeError: Parse() argument 1 must be string or read-only buffer, not instancemethod
  </code></pre>