Python, suds, array management


I am using the suds library to retrieve a list of products from a web service.

This is a sample code:

from suds.client import Client url = 'WSDLURL' client = Client(url) result = client.service.Research('value') 

The result contains:

 (ArrayOfProducts){ Product[] = (Product){ Id = 218 Code = "C024" Name = "test2" Avaiable = True UrlDownload = None MetaData = (ArrayOfMetaData){ MetaData[] = (MetaData){ CoderepositoryISO = "16701" Title = "1ST" }, } }, (Product){ Id = 219 Code = "C025" Name = "test3" Avaiable = True UrlDownload = None MetaData = (ArrayOfMetaData){ MetaData[] = (MetaData){ CoderepositoryISO = "16702" Title = "2ND" }, } }, ... 

Is there a way in python or foaming to access a closed data loop on products using for? (e.g.: Product.Id, Product.Code, etc.)

+4
source share
1 answer

Ideal ... Thanks to J.F. Sebastian, I find the right way ... This is the working code:

 from suds.client import Client url = 'wsdl' client = Client(url) html_out = "" result = client.service.Research('a') for p in result.Product: print p.Id print p.Name 
+4
source

Source: https://habr.com/ru/post/1332330/


All Articles