Python-zeep: How to set attribute and value to the same element?

Created on 14 Sep 2017  路  2Comments  路  Source: mvantellingen/python-zeep

Hello,

I havent exactly bug, rather cant set dictinoary for specific instance. I try to search in your documentation or in the internet articles or discussion, but no success. Maybe, its a trifle and I'm a fool.

I would like to prepare the right dictionary in zepp, which describe element "SENDER". This element have a value and also the attribute, like this: 0080

I found some examples, where are elements with attribute, but without value, like this: 0080.

My script can assing the attribute to to element, but cant assing the value to the same element. Please, could you help me?

The request, which is sent: None

And I need: 0080

Thank you for any help or information about this. I'm sorry if the issue is stupid, and wasting your time.

Martin


  1. zeep version: 2.3.0
  2. provoz.szdc.cz/kadrws/taftsi2_1.asmx?WSDL
  3. script:

client = Client('http://provoz.szdc.cz/kadrws/taftsi2_1.asmx?WSDL')
node = client.create_message(client.service, 'CZRequestOnAvailableIDMessage',
message =
{
'MessageHeader': {
'MessageReference': {
'MessageType': '1000',
'MessageTypeVersion': '2.1',
'MessageIdentifier' : 'kzc',
'MessageDateTime' : datetime.datetime.utcnow(),
},
'Sender': {
'CI_InstanceNumber': '01'},
},
'AllPathsOfTheCompany': "false",
'PathModificationDate': datetime.datetime.utcnow(),
})

return (etree.tostring(node, pretty_print=True))

Most helpful comment

The solution is simple as ussualy:)

    'Sender': {
        'CI_InstanceNumber': 'attribute_value',
        '_value_1': 'element_value'},

Martin

All 2 comments

The solution is simple as ussualy:)

    'Sender': {
        'CI_InstanceNumber': 'attribute_value',
        '_value_1': 'element_value'},

Martin

Yeah the whole _value_x thing is still mwehhhhh :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ZeWaren picture ZeWaren  路  3Comments

grguthrie picture grguthrie  路  4Comments

allan-simon picture allan-simon  路  4Comments

alexdemari picture alexdemari  路  4Comments

majackson picture majackson  路  6Comments