Posts

Showing posts from January, 2009

Python SUDS with Windows Authentication (SOAP)

While intergrating Plone with CRM4, I stumbled upon Suds. However, it didn't support NTLM. Then I found python-ntlm, and merged the two libs. Below is the result. You can add it at the bottom of suds/transport.py class WindowsHttpAuthenticated(HttpAuthenticated): """ Provides Windows (NTLM) http authentication. @ivar pm: The password manager. @ivar handler: The authentication handler. @author: Christopher Bess """ def __init__(self, options): # try to import ntlm support try: from ntlm import HTTPNtlmAuthHandler except ImportError: raise Exception("Cannot import python-ntlm module") return HttpTransport.__init__(self, options) self.pm = u2.HTTPPasswordMgrWithDefaultRealm() self.handler = HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(self.pm) self.urlopener = u2.build_opener(self.handler) u2.install_opener(self.urlopener)