我想使用 Python(C-Python)与 SharePoint 进行集成。
有没有人尝试过这种方法?
我想使用 Python(C-Python)与 SharePoint 进行集成。
有没有人尝试过这种方法?
我怀疑自从这个问题得到回答以来,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)
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身份验证代理。
感谢Rob和Enzondio给予的提示!
SharePoint提供了几个Web服务,您可以使用这些服务来查询和更新数据。
我不确定Python有哪些Web服务工具包,但它们应该能够轻松地为这些服务构建代理。
本文应该为您提供足够的信息以便开始使用。