On Thursday 16 December 2010, Mauro Petrone elucidated thus:
Hi to all,
I'm using suds library to fetch a list of products from a webservice.
This is a sample code:
|from suds.clientimport Client
url= 'WSDLURL'
client= Client(url)
result= client.service.Research('value')
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"
},
}
},
...
There is a way, in pyton or suds, to access directly to the contained
data cycling on the products with a for? (e.g.: Product.Id,
Product.Code, etc.)
Thank You,
Mauro
From the data that you posted, it looks like this will work:
for prod in result.Product:
print prod.Id, prod.Code
j
--
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com - Fairbanks, AK
PGP Key:
http://pgp.mit.edu/ ID 0x73B13B6A