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

4

10

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

Has anyone tried this before ?

Yeld answered 20/10, 2008 at 16:9 Comment(0)
S
10

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:


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)

Stivers answered 23/3, 2011 at 9:36 Comment(1)
Unfortunately, suds doesn't seem to play well with python3 and suds-jerko can be cajoled into it but requires the python-ntlm library which won't install on Windows.Harmonyharmotome
Y
9

To get the 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

To Rob and Enzondio : THANKS for your hints !

Yeld answered 21/10, 2008 at 15:13 Comment(0)
M
4

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

Maccarone answered 20/10, 2008 at 17:29 Comment(1)
This is now very out of date and the SOAPpy library it uses is deprecatedHarmonyharmotome
A
3

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

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.

This article should give you enough information to get started.

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

Anciently answered 20/10, 2008 at 17:5 Comment(1)
Unfortunately, python does not play well with NTLM authentication (and even less so with Kerberos!) so the SOAP part is easy but the auth is problematicHarmonyharmotome

© 2022 - 2024 — McMap. All rights reserved.