2008-10-20 31 views

回答

10

我怀疑,因为这个问题被回答SUDS库已更新,以照顾所需的认证本身通过各种铁圈跳后,我发现这做诀窍:


from suds import WebFault 
from suds.client import * 
from suds.transport.https import WindowsHttpAuthenticated 


user = r'SERVER\user' 
password = "yourpassword" 
url = "http://sharepointserver/_vti_bin/SiteData.asmx?WSDL" 


ntlm = WindowsHttpAuthenticated(username = user, password = password) 
client = Client(url, transport=ntlm) 

+0

不幸的是,suds似乎不能很好地与python3兼容,并且suds-jerko可以隐藏到它中,但需要python-ntlm库,它不会在Windows上安装。 – Basic 2015-02-12 15:33:29

3

SharePoint提供了几个可用于查询和更新数据的Web服务。

我不确定Python有哪些Web服务工具包,但他们应该能够毫无问题地为这些服务构建代理。

这篇文章应该给你足够的信息来开始。

http://www.developer.com/tech/article.php/3104621

+0

不幸的是,Python不使用NTLM身份验证(!与Kerberos和更少了)发挥出色,因此SOAP部分是容易的,但在auth是有问题的 – Basic 2015-02-12 15:36:01

4

SOAP与Python是很容易的。 Here's a tutorial from Dive Into Python。

+1

现在这是非常过时和SOAPpy的的它使用的库已被弃用 – Basic 2015-02-12 15:36:51

9

要获得WSDL:

import sys 

# we use suds -> https://fedorahosted.org/suds 
from suds import WebFault 
from suds.client import * 
import urllib2 

# my 2 url conf 
# url_sharepoint,url_NTLM_authproxy 
import myconfig as my 

# build url 
wsdl = '_vti_bin/SiteData.asmx?WSDL' 
url = '/'.join([my.url_sharepoint,wsdl]) 


# we need a NTLM_auth_Proxy -> http://ntlmaps.sourceforge.net/ 
# follow instruction and get proxy running 
proxy_handler = urllib2.ProxyHandler({'http': my.url_NTLM_authproxy }) 
opener = urllib2.build_opener(proxy_handler) 

client = SoapClient(url, {'opener' : opener}) 

print client.wsdl 

主要(平均)的问题: 在SharePoint服务器使用NTLM身份验证[:-(] ,所以我不得不使用NTLM认证 - 代理

抢劫和Enzondio:感谢您的提示