使用 python-suds 导入 adsense api v3 wsdl 时出错

发布于 2024-11-16 22:54:17 字数 1850 浏览 2 评论 0原文

此脚本

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文