Microsoft Dynamics CRM服务使用NTLM身份验证,这使得使用suds稍微复杂的python进程连接到它。我正在寻找一个代码示例:
RetrieveAttributeRequest
Execute
请求的回复。这必须使用Python 2.6或Python 2.7,而不是Python 3.我已经有一个使用curl的工作实现,但它在最好的时候是片状的,并且作为我在这个工具中的一些其他工作的一部分我想清理它并使用python / suds运行它。
答案 0 :(得分:5)
我知道这有点晚了,但希望它会对某人有所帮助。
NTLM身份验证已添加到version 0.3.8中的suds。
from suds.transport.https import WindowsHttpAuthenticated
from suds.client import Client
url = 'http://crmurl/XRMServices/2011/Discovery.svc?wsdl'
ntlm = WindowsHttpAuthenticated(username='DOMAIN\username', password='password')
client = Client(url, transport=ntlm)
答案 1 :(得分:0)
我不知道这对您是否有帮助,但我使用PycURL来通过NTLM代理。
以下是代码段:
c = Curl()
c.setopt(URL, 'http://www.somesite.com')
c.setopt(FOLLOWLOCATION, 1) # follow redirects
c.setopt(MAXREDIRS, 5) # max redirects
c.setopt(PROXY, 'proxy.somesite.com')
c.setopt(PROXYUSERPWD, 'DOMAIN/USER:PASSWORD')
c.setopt(PROXYAUTH, HTTPAUTH_NTLM) # use NTLM
c.perform()
以下是Curl
对象上的documentation。