After a long struggle with ZSI and SoapPY i found suds. It looks like a really good solution, code base is pretty clean as well.
I however can't seem to get it too work with the adwords api. Im using the latest trunk checkout (r267) Any suggestions as to what is causing this?
Code: from suds.client import Client wsdl = 'https://adwords.google.com/api/adwords/v12/CampaignService?wsdl' c = Client(wsdl) def headers(c): headers = ad_settings.headers tokens = [] for k,v in headers.items(): token = c.factory.create(k) token.value = v tokens.append(token) return tokens accounts = c.service.getAllAdWordsCampaigns(1, soapheaders=headers(c)) pprint(accounts)
Gives the error: Traceback (most recent call last): File "D:\development\workspace\pytm2\ytm\adwords\adwords_api_ytm\test.py", line 164, in <module> main() File "D:\development\workspace\pytm2\ytm\adwords\adwords_api_ytm\test.py", line 29, in main accounts = c.service.getAllAdWordsCampaigns(1, soapheaders=headers(c)) File "C:\Python25\lib\site-packages\suds\client.py", line 186, in __call__ result = self.client.invoke(self, args, kwargs) File "C:\Python25\lib\site-packages\suds\client.py", line 296, in invoke msg = binding.get_message(method.name, args, soapheaders) File "C:\Python25\lib\site-packages\suds\bindings\binding.py", line 105, in get_message header = self.header(soapheaders) File "C:\Python25\lib\site-packages\suds\bindings\binding.py", line 283, in header node = marshaller.process(value, type, tag) File "C:\Python25\lib\site-packages\suds\bindings\marshaller.py", line 521, in process result = MBase.process(self, content) File "C:\Python25\lib\site-packages\suds\bindings\marshaller.py", line 372, in process self.append(root, content) File "C:\Python25\lib\site-packages\suds\bindings\marshaller.py", line 389, in append if self.start(content): File "C:\Python25\lib\site-packages\suds\bindings\marshaller.py", line 554, in start if self.__skip(content): File "C:\Python25\lib\site-packages\suds\bindings\marshaller.py", line 661, in __skip if content.type.optional(): File "C:\Python25\lib\site-packages\suds\xsd\sxbasic.py", line 427, in optional return ( self.container.optional() or self.min == '0' ) AttributeError: 'NoneType' object has no attribute 'optional'