title: XML POST with Python Requests
body: <p>I'm trying to use the <a href="http://uclassify.com/XmlApiDocumentation.aspx" rel="nofollow">uClassify API</a> to categorize objects based on a text. To interact with the API, I need to make XML POST requests, such as:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;uclassify xmlns="http://api.uclassify.com/1/RequestSchema" version="1.01"&gt;
    &lt;writeCalls writeApiKey="YOUR_WRITE_API_KEY_HERE" classifierName="ManOrWoman"&gt;
      &lt;create id="CreateManOrWoman"/&gt;
    &lt;/writeCalls&gt;
  &lt;/uclassify&gt;
  </code></pre>
  
  <p>I tried to do this using the HTTP Requests module as well as xml.etree.ElementTree to create an XML tree, but I am getting errors left and right. Here's some code I tried:</p>
  
  <pre><code>&gt;&gt;&gt; import elementtree.ElementTree as ET
  &gt;&gt;&gt; from xml.etree.cElementTree import Element, ElementTree
  &gt;&gt;&gt; import requests
  &gt;&gt;&gt;
  &gt;&gt;&gt; root = ET.Element("uclassify", xlms="http://api.uclassify.com/1/RequestSchema", version="1.01")
  &gt;&gt;&gt; head = ET.SubElement(root, "writeCalls", writeApiKey="*************", classifierName="test")
  &gt;&gt;&gt; action = ET.SubElement(head, "create", id="CreateTest")
  &gt;&gt;&gt; tree = ElementTree(root)
  &gt;&gt;&gt;
  &gt;&gt;&gt; r = requests.post('http://api.uclassify.com/', tree)
  &gt;&gt;&gt; 
  &gt;&gt;&gt; ........
  &gt;&gt;&gt; TypeError: must be convertible to a buffer, not ElementTree
  </code></pre>