gpt4 book ai didi

python - suds 脚本失败,出现异常异常 : imported schema failed, 找不到记录器 "suds.xsd.sxbasic"的处理程序

转载 作者:太空宇宙 更新时间:2023-11-04 06:25:00 28 4
gpt4 key购买 nike

Python 新手。尝试使用 Python 构建一个简单的 soap 客户端。相同的程序在不涉及代理的环境中工作。

***********Version 1
import suds
import urllib2
t = suds.transport.http.HttpTransport()
proxy = urllib2.ProxyHandler({'http': 'http://xxx.xxx.xxx.xxx:xx'})
opener = urllib2.build_opener(proxy)
t.urlopener = opener
ws = suds.client.Client('http://Server:13080/SM/7/ServiceDesk.wsdl', transport=t)
>>>
No handlers could be found for logger "suds.xsd.sxbasic"
Traceback (most recent call last):
File "C:\localdisk\Python\testSoap.py", line 20, in <module>
ws = suds.client.Client('http://Server:13080/SM/7/ServiceDesk.wsdl', transport=t)
File "build\bdist.win32\egg\suds\client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "build\bdist.win32\egg\suds\reader.py", line 152, in open
d = self.fn(url, self.options)
File "build\bdist.win32\egg\suds\wsdl.py", line 159, in __init__
self.build_schema()
File "build\bdist.win32\egg\suds\wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "build\bdist.win32\egg\suds\xsd\schema.py", line 93, in load
child.open_imports(options)
File "build\bdist.win32\egg\suds\xsd\schema.py", line 305, in open_imports
imported = imp.open(options)
File "build\bdist.win32\egg\suds\xsd\sxbasic.py", line 542, in open
result = self.download(options)
File "build\bdist.win32\egg\suds\xsd\sxbasic.py", line 567, in download
raise Exception(msg)
Exception: imported schema (http://www.w3.org/2005/05/xmlmime) at (http://www.w3.org/2005/05/xmlmime), failed
>>>


**********Version2*********
from suds.client import Client
from suds import WebFault
url = 'http://Server:13080/SM/7/ServiceDesk.wsdl'
userid = 'falcon'
passwd = ''
d = dict(http='http://xxx.xxx.xxx.xxx:xx')
client = Client(url, proxy=d)
print client
>>>
No handlers could be found for logger "suds.xsd.sxbasic"
Traceback (most recent call last):
File "C:\localdisk\Python\smWSDL.py", line 24, in <module>
client = Client(url, proxy=d)
File "build\bdist.win32\egg\suds\client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "build\bdist.win32\egg\suds\reader.py", line 152, in open
d = self.fn(url, self.options)
File "build\bdist.win32\egg\suds\wsdl.py", line 159, in __init__
self.build_schema()
File "build\bdist.win32\egg\suds\wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "build\bdist.win32\egg\suds\xsd\schema.py", line 93, in load
child.open_imports(options)
File "build\bdist.win32\egg\suds\xsd\schema.py", line 305, in open_imports
imported = imp.open(options)
File "build\bdist.win32\egg\suds\xsd\sxbasic.py", line 542, in open
result = self.download(options)
File "build\bdist.win32\egg\suds\xsd\sxbasic.py", line 567, in download
raise Exception(msg)
Exception: imported schema (http://www.w3.org/2005/05/xmlmime) at (http://www.w3.org/2005/05/xmlmime), failed
>>>
*********************************************************

我已经检查了 SUDS 文档 @ https://fedorahosted.org/suds/wiki/Documentation ,不能收集太多 - 也许我忽略了一些东西。非常感谢您的意见,谢谢。

最佳答案

我注意到在您指向的文档中,代理指定为:

{http:'host:port'}

不是

{http:'http://host:port'}

难道是这样吗?

关于python - suds 脚本失败,出现异常异常 : imported schema failed, 找不到记录器 "suds.xsd.sxbasic"的处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8988109/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com