title: Suds throwing 403 Forbidden on SharePoint
body: <p>I'm having an issue with getting suds to authenticate using the python-ntlm package against a SharePoint 2010 site. I have tried the solutions linked in <a href="https://stackoverflow.com/questions/7617900/403-forbidden-error-for-python-suds-contacting-sharepoint">this thread</a> with no luck.</p>
  
  <p>I'm running Python 2.7.10, suds 0.4, and python-ntlm 1.1.0.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>from suds.client import *
  from suds.transport.https import WindowsHttpAuthenticated
  
  import logging
  logging.basicConfig(level=logging.INFO)
  logging.getLogger('suds.client').setLevel(logging.DEBUG)
  logging.getLogger('suds.transport').setLevel(logging.DEBUG)
  logging.getLogger('ntlm').setLevel(logging.DEBUG)
  
  url = "https://web.site.com/sites/Collection/_vti_bin/Lists.asmx?WSDL"
  ntlm = WindowsHttpAuthenticated(username='DOMAIN\UserName',
                                  password='Password')
  client = Client(url, transport=ntlm)
  client.service.GetListCollection()
  </code></pre>
  
  <p>Here's the debug output:</p>
  
  <pre><code>DEBUG:suds.transport.http:opening (https://web.site.com/sites/Collection/_vti_bin/Lists.asmx?WSDL)
  DEBUG:suds.transport.http:opening (http://www.w3.org/2001/XMLSchema.xsd)
  DEBUG:suds.transport.http:opening (http://www.w3.org/2001/xml.xsd)
  DEBUG:suds.client:sending to (https://web.site.com/sites/Collection/_vti_bin/Lists.asmx)
  message:
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;ns0:Body&gt;
        &lt;ns1:GetListCollection/&gt;
     &lt;/ns0:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  DEBUG:suds.client:headers = {'SOAPAction': u'"http://schemas.microsoft.com/sharepoint/soap/GetListCollection"', 'Content-Type': 'text/xml; charset=utf-8'}
  DEBUG:suds.transport.http:sending:
  URL:https://web.site.com/sites/Collection/_vti_bin/Lists.asmx
  HEADERS: {'SOAPAction': u'"http://schemas.microsoft.com/sharepoint/soap/GetListCollection"', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Soapaction': u'"http://schemas.microsoft.com/sharepoint/soap/GetListCollection"'}
  MESSAGE:
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;SOAP-ENV:Header/&gt;&lt;ns0:Body&gt;&lt;ns1:GetListCollection/&gt;&lt;/ns0:Body&gt;&lt;/SOAP-ENV:Envelope&gt;
  ERROR:suds.client:&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;SOAP-ENV:Header/&gt;
     &lt;ns0:Body&gt;
        &lt;ns1:GetListCollection/&gt;
     &lt;/ns0:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  DEBUG:suds.client:http failed:
  403 FORBIDDEN
  Traceback (most recent call last):
    File "C:/Users/username/PycharmProjects/Suds/soap.py", line 14, in &lt;module&gt;
      client.service.GetListCollection()
    File "C:\Python27\lib\site-packages\suds\client.py", line 542, in __call__
      return client.invoke(args, kwargs)
    File "C:\Python27\lib\site-packages\suds\client.py", line 602, in invoke
      result = self.send(soapenv)
    File "C:\Python27\lib\site-packages\suds\client.py", line 649, in send
      result = self.failed(binding, e)
    File "C:\Python27\lib\site-packages\suds\client.py", line 708, in failed
      raise Exception((status, reason))
  Exception: (403, u'Forbidden')
  </code></pre>
  
  <p>However, the equivalent works perfectly fine in cURL (formatted for readability)</p>
  
  <pre><code>curl -u 'Username':'Password' --ntlm -X POST \
   -H 'Content-Type: text/xml'\
   -H 'SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/GetListCollection"' \
   "https://web.site.com/sites/Collection/_vti_bin/Lists.asmx" \ 
   --data-binary @soapenvelope.xml
  </code></pre>
  
  <p>I also have not been able to find a way to force suds to run through a Fiddler proxy while also passing NTLM authentication. Outlined <a href="https://stackoverflow.com/questions/12414600/suds-ignoring-proxy-setting">here</a>, it seems to ignore proxy settings anyway, and I can't find a way to mix and match the local proxy through fiddler <em>and</em> have it attempt NTLM authentication against the Lists web service.</p>
  
  <p>Environment Information (to make this easily searchable):</p>
  
  <ul>
  <li>SharePoint 2010</li>
  <li>Forms Based Authentication / FedAuth</li>
  <li>External Oracle SSO using SAML v1.x</li>
  </ul>