Skip to main content
 首页 » 编程设计

python之是否有人能够让 Python suds 与 Exchange Web 服务一起工作

2025年05月04日36lori

我正在尝试调用一些方法,例如 UpdateItem,但没有成功。我不断收到以下错误:

异常:导入模式 (http://www.w3.org/XML/1998/namespace) 在 (http://www .w3.org/2001/xml.xsd), 失败

如果有人可以发布一些创建客户端并成功调用方法的工作代码,我将不胜感激。谢谢。我在某处读到将架构文件本地下载到我的电脑上可能会有所帮助,但我也不确定如何在我的代码中实现它。这是我目前所拥有的:

import urllib2 
import suds 
import logging 
from suds import WebFault 
from suds.client import Client 
from suds.client import Factory 
from suds.transport.http import HttpAuthenticated 
from logging import getLogger 
logging.getLogger('suds.client').setLevel(logging.CRITICAL) 
from suds.xsd.doctor import ImportDoctor, Import 
 
# cannot access schema through browser 
imp = Import('http://schemas.microsoft.com/exchange/services/2006/messages') 
d = ImportDoctor(imp) 
client = Client('http:path to wsdl', doctor = d, username='my_username',        
password='my_password') 
retVal = client.service.GetServerTimeZones() 
print retVal 

请您参考如下方法:

推荐使用suds-ews叉。此外,您还必须实现 ntlm 身份验证。