有没有人将soap.py或suds与python-ntlm结合起来?

Chr*_*s R 7 python soap ntlm soappy suds

我想用suds或soap.py替换应用程序当前(严重破坏和狡猾)基于cURL(基于cURL 命令行!)的SOAP客户端.麻烦的是,我们必须联系MS CRM服务,因此必须使用NTLM.由于各种原因,NTLM代理使用起来有点痛苦,所以我正在研究python-ntlm来提供这种支持.

可以使用suds或soap.py来使用此身份验证方法吗?如果是这样,怎么样?如果没有,任何其他建议都会很棒.

编辑

如下所述,suds已经开箱即用支持python-ntlm.

sys*_*out 6

自0.3.8以来,Suds 被修复以支持它.

python-suds-0.3.9\suds\transport\https.py的来源说:

class WindowsHttpAuthenticated(HttpAuthenticated):
    """
    Provides Windows (NTLM) http authentication.
    @ivar pm: The password manager.
    @ivar handler: The authentication handler.
    """

    def u2handlers(self):
        # try to import ntlm support  
        try:
            from ntlm import HTTPNtlmAuthHandler
        except ImportError:
            raise Exception("Cannot import python-ntlm module")
        handlers = HttpTransport.u2handlers(self)
        handlers.append(HTTPNtlmAuthHandler.HTTPNtlmAuthHandler(self.pm))
        return handlers
Run Code Online (Sandbox Code Playgroud)

用下面的代码片段尝试描述在这里:

from suds.transport.https import WindowsHttpAuthenticated
ntlm = WindowsHttpAuthenticated(username='xx', password='xx')
client = Client(url, transport=ntlm)
Run Code Online (Sandbox Code Playgroud)