我如何从 python 使用共享点(通过soap?)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/218987/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 19:39:55  来源:igfitidea点击:

how can i use sharepoint (via soap?) from python?

pythonsharepointsoapntlmsuds

提问by Blauohr

I want to use Sharepoint with python (C-Python)

我想将 Sharepoint 与 python (C-Python) 一起使用

Has anyone tried this before ?

有没有人试过这个?

回答by somewhatoff

I suspect that since this question was answered the SUDS library has been updated to take care of the required authentication itself. After jumping through various hoops, I found this to do the trick:

我怀疑自从回答了这个问题后,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)

回答by Blauohr

To get the wsdl :

要获取 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

main (mean) problem: the sharepoint-server uses a NTLM-Auth [ :-( ] so i had to use the NTLM-Auth-Proxy

主要(平均)问题:sharepoint-server 使用 NTLM-Auth [:-(] 所以我不得不使用 NTLM-Auth-Proxy

To Rob and Enzondio : THANKS for your hints !

致 Rob 和 Enzondio:感谢您的提示!

回答by enzondio

SOAP with Python is pretty easy. Here's a tutorialfrom Dive Into Python.

使用 Python 的 SOAP 非常简单。这是Dive Into Python的教程

回答by Rob Windsor

SharePoint exposes several web services which you can use to query and update data.

SharePoint 公开了多个可用于查询和更新数据的 Web 服务。

I'm not sure what web service toolkits there are for Python but they should be able to build proxies for these services without any issues.

我不确定 Python 有哪些 Web 服务工具包,但它们应该能够为这些服务构建代理而不会出现任何问题。

This article should give you enough information to get started.

本文应该为您提供足够的信息以开始使用。

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

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