使用Python通过SOAP访问SharePoint

0 投票
1 回答
1588 浏览
提问于 2025-04-15 12:39

我一直在关注这里提到的解决方案,因为这正是我想要实现的目标;

我该如何通过Python使用SharePoint(通过SOAP)?

但是,当我运行这段代码的最后几行时,出现了以下错误;

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

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "build\bdist.win32\egg\suds\client.py", line 456, in __init__
AttributeError: 'str' object has no attribute 'options'

任何建议或解决方案都非常欢迎!

1 个回答

1

根据 这个链接

434     class SoapClient:
...
445         """
446     
447         def __init__(self, client, method):
448             """
449             @param client: A suds client.
450             @type client: L{Client}
451             @param method: A target method.
452             @type method: L{Method}
453             """
454             self.client = client
455             self.method = method
456             self.options = client.options
457             self.cookiejar = CookieJar()

这里提到的 SoapClient 的第一个参数其实不是一个简单的文本字符串,而是一个 Client 类的对象。也就是说,你传入的参数并不是所需的那个类的实例。

撰写回答