title: Python SOAP request using urllib2
body: <p>I'm attempting to write a script to communicate with sharepoint via SOAP using urllib2 in Python. My code is connecting successfully to a sharepoint list, but does not do anything once connected. Could my SOAP request be wrong? It seems to be returning nothing, despite 2 list items existing on the sharepoint site.</p>
  
  <pre><code>import urllib2
  from ntlm import HTTPNtlmAuthHandler
  
  user = r'DOMAIN\myusername'
  password = "password"
  url = "https://mysecuresite.com/site/_vti_bin/Lists.asmx"
  
  passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
  passman.add_password(None, url, user, password)
  # create the NTLM authentication handler
  auth_NTLM = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(passman)
  
  # create and install the opener
  opener = urllib2.build_opener(auth_NTLM)
  urllib2.install_opener(opener)
  
  request="""&lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;SOAP:ENVELOPE xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
      &lt;SOAP:BODY&gt;
          &lt;?XML:NAMESPACE PREFIX = "[default] http://schemas.microsoft.com/sharepoint/soap/" NS = "http://schemas.microsoft.com/sharepoint/soap/" /&gt;&lt;GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"&gt;
              &lt;listName&gt;site&lt;/listName&gt;
              &lt;query&gt;&lt;/query&gt;
              &lt;rowLimit&gt;&lt;/rowLimit&gt;
          &lt;/GetListItems&gt;
      &lt;/SOAP:BODY&gt;
  &lt;/SOAP:ENVELOPE&gt;
  """
  
  headers={"SOAPAction":"\"http://schemas.microsoft.com/sharepoint/soap/GetListItems\"","Content-Type":"text/xml;charset=UTF-8"}
  
  req = urllib2.Request(url, request, headers)
  
  response=urllib2.urlopen(req)
  data = response.read()
  print data
  </code></pre>
  
  <p>I've tried using libraries like haufe.sharepoint, but they don't play nice with HTTPS and ntlm.</p>