Python-Suds 连接 Sharepoint 时出现 403 Forbidden 错误

1 投票
1 回答
1702 浏览
提问于 2025-04-17 03:28

我正在使用Python的SUDs库来访问Sharepoint的网络服务。
我按照Suds网站上的标准文档进行了操作。
但是在过去的两天里,无论我访问哪个服务,远程服务总是返回403禁止访问的错误。

我使用的是Suds 0.4版本,它内置了对Python NTLM的支持。

如果有人知道这是什么问题,请告诉我。

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

import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)


ntlm = WindowsHttpAuthenticated(username='USER_ID', password='PASS')
c_lists = client.Client(url='https://SHAREPOINT_URL/_vti_bin/Lists.asmx?WSDL', transport=ntlm)
#c_lists = client.Client(url='https://SHAREPOINT_URL/_vti_bin/spsearch.asmx?WSDL')

#print c_lists

listsCollection = c_lists.service.GetListCollection()

1 个回答

1

你是不是按照 DOMAIN\USER_ID 的格式来指定用户名,就像在 python-ntlm 库的示例中那样?(你也可以看看 这个回答)。

撰写回答