Python-zeep: how to send nested data using python dict / list?

Created on 12 Aug 2016  路  1Comment  路  Source: mvantellingen/python-zeep

Not sure if it's a bug or if I'm doing this wrong but how do you send nested data?

For example, given this structure:

<UpdateGroup>
    <Var1>xxx</Var1>
    <Objs>
        <Obj>
            <a1>1</a1>
            <a2>1</a2>
        </Obj>
        <Obj>
            <a1>2</a1>
            <a2>2</a2>
        </Obj>
    </Objs>
</UpdateGroup>
data = {}
client.service.UpdateGroup(**data)

I tried those 2 ways but it did not work. Looking at the xml, the Objs were not there.

# Test 1
data = {
  "Var1": "test",
  "Objs": [
    {
      'a1': 1, 'a2': 1
    },
    {
      'a1': 2, 'a2': 2
    },
  ]
}
# Test 2
data = {
  "Var1": "test",
  "Objs": [
    {
      'Obj': { 'a1': 1, 'a2': 1 }
    },
    {
      'Obj': { 'a1': 2, 'a2': 2 }
    },
  ]
}

Thanks.

Most helpful comment

Nevermind, I just found how it works:

data = {
  "Var1": "test",
  "Objs": {
    'Obj': [
      {'a1': 1, 'a2': 1}, 
      {'a1': 2, 'a2': 2}
    ]
  }
}

>All comments

Nevermind, I just found how it works:

data = {
  "Var1": "test",
  "Objs": {
    'Obj': [
      {'a1': 1, 'a2': 1}, 
      {'a1': 2, 'a2': 2}
    ]
  }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

YAmikep picture YAmikep  路  3Comments

alexfx picture alexfx  路  4Comments

olivierverville picture olivierverville  路  3Comments

ryan-mccaffrey picture ryan-mccaffrey  路  5Comments

vadivelkindhealth picture vadivelkindhealth  路  3Comments