0

It's very easy to create a Zeep object with heterogeneous elements, for example:

<A>
  <B>
    <C>foo</C>
    <D>bar</D>
  </B>
  <E>
    <C>foo</C>
    <D>bar</D>
  </E>
</A>

Is created with (and this illustrates the various different ways):

A(
  B={"C": "foo", "D": "bar"},
  E={"C": "foo", "D": "bar"},
)

What is unclear is how you're meant to create a structure with homogenous elements like this:

<A>
  <B>
    <C>foo</C>
    <D>bar</D>
  </B>
  <B>
    <C>foo</C>
    <D>bar</D>
  </B>
</A>

How do you represent this with Zeep client types?

Eamonn M.R.
  • 1,917
  • 2
  • 17
  • 23

1 Answers1

1

Searched for this a few weeks back and it has a reasonable answer.

<A>
  <B>
    <C>foo</C>
    <D>bar</D>
  </B>
  <B>
    <E>far</E>
    <F>boo</F>
  </B>
</A>

will be represented in zeep - like dict with list of dicts as a value

dic = dict(
  A=dict(
    B=[
      {"C": "foo", "D": "bar"},
      {"E": "far", "F": "boo"},
    ]
  )
)

:yay:

also found it also here, so probly a duplicate?

gr4viton
  • 109
  • 1
  • 2