使用 python-suds 导入 adsense api v3 wsdl 时出错
此脚本
from suds.client import Client
server = "https://sandbox.google.com"
client = Client(server + "/api/adsense/v3/AccountService?wsdl")
print client
不适用于 AdSense API v3:
$ ./v3_bug.py
Traceback (most recent call last):
File "./v3_bug.py", line 4, in <module>
client = Client(server + "/api/adsense/v3/AccountService?wsdl")
File "/usr/lib/python2.6/dist-packages/suds/client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "/usr/lib/python2.6/dist-packages/suds/reader.py", line 152, in open
d = self.fn(url, self.options)
File "/usr/lib/python2.6/dist-packages/suds/wsdl.py", line 159, in __init__
self.build_schema()
File "/usr/lib/python2.6/dist-packages/suds/wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "/usr/lib/python2.6/dist-packages/suds/xsd/schema.py", line 95, in load
child.dereference()
File "/usr/lib/python2.6/dist-packages/suds/xsd/schema.py", line 323, in dereference
midx, deps = x.dependencies()
File "/usr/lib/python2.6/dist-packages/suds/xsd/sxbasic.py", line 469, in dependencies
raise TypeNotFound(self.ref)
suds.TypeNotFound: Type not found: '(Exception, http://www.w3.org/2001/XMLSchema, )'
如果我将 v3 更改为 v2,则一切正常:
$ ./v3_bug.py
Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913
Service ( AccountServiceService ) tns="http://www.google.com/api/adsense/v2"
Prefixes (1)
ns0 = "http://www.google.com/api/adsense/v2"
Ports (1):
(AccountService)
Methods (16):
addSyndicationService(SyndicationService_Type synServiceType, )
...
我了解 医生,但我不知道错误在哪里。
This script
from suds.client import Client
server = "https://sandbox.google.com"
client = Client(server + "/api/adsense/v3/AccountService?wsdl")
print client
doesn't work with AdSense API v3:
$ ./v3_bug.py
Traceback (most recent call last):
File "./v3_bug.py", line 4, in <module>
client = Client(server + "/api/adsense/v3/AccountService?wsdl")
File "/usr/lib/python2.6/dist-packages/suds/client.py", line 112, in __init__
self.wsdl = reader.open(url)
File "/usr/lib/python2.6/dist-packages/suds/reader.py", line 152, in open
d = self.fn(url, self.options)
File "/usr/lib/python2.6/dist-packages/suds/wsdl.py", line 159, in __init__
self.build_schema()
File "/usr/lib/python2.6/dist-packages/suds/wsdl.py", line 220, in build_schema
self.schema = container.load(self.options)
File "/usr/lib/python2.6/dist-packages/suds/xsd/schema.py", line 95, in load
child.dereference()
File "/usr/lib/python2.6/dist-packages/suds/xsd/schema.py", line 323, in dereference
midx, deps = x.dependencies()
File "/usr/lib/python2.6/dist-packages/suds/xsd/sxbasic.py", line 469, in dependencies
raise TypeNotFound(self.ref)
suds.TypeNotFound: Type not found: '(Exception, http://www.w3.org/2001/XMLSchema, )'
If I change v3 to v2, everything works fine:
$ ./v3_bug.py
Suds ( https://fedorahosted.org/suds/ ) version: 0.4 GA build: R699-20100913
Service ( AccountServiceService ) tns="http://www.google.com/api/adsense/v2"
Prefixes (1)
ns0 = "http://www.google.com/api/adsense/v2"
Ports (1):
(AccountService)
Methods (16):
addSyndicationService(SyndicationService_Type synServiceType, )
...
I know about doctors, but I don't know where the error is.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论