I am tryng to conenct to a SOAP webservice and use pandas to put in on a table.
Zeep give me this list:
[{
    'ssPeca': '103',
    'ssQtd': '1',
    'ssUn': 'un'
}, {
    'ssPeca': '291A',
    'ssQtd': '8',
    'ssUn': 'un'
}, {
    'ssPeca': '406B',
    'ssQtd': '8',
    'ssUn': 'un'
}]
my code is this:
client = zeep.Client(wsdl=wsdl)
pecas=client.service.TabelaPecas("C-160","CR")
pd.DataFrame.from_dict(pecas)
and that code generate this:
      0     1    2
0  ssPeca ssQtd ssUn 
1  ssPeca ssQtd ssUn 
2  ssPeca ssQtd ssUn 
but i want this:
      0     1    2
0    103    1   un 
1    291A   8   un 
2    406B   8   un 
can anyone help? i am just a beginner in python.
Zeep has a function to transform the response into python objects. Eg: Ordered Dict.
You should use:
from zeep.helpers import serialize_object
client = zeep.Client(wsdl=wsdl)
pecas=client.service.TabelaPecas("C-160","CR")
pecas = serialize_object(pecas)
pd.DataFrame(pecas)
source: http://docs.python-zeep.org/en/latest/helpers.ht
edit: Fixed typo, thanks voglster
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With