python-zeep icon indicating copy to clipboard operation
python-zeep copied to clipboard

Reserved words not mangled in type properties

Open da1910 opened this issue 5 years ago • 2 comments

We have a type that looks like

<complexType name="problemType">
  <element name="from" type="token" />
  <element name="to" type="token" />
</complexType>

This means that we have a type which we need to access as:

myObject #  type: problemType
myObject.from

This is invalid syntax as from is a reserved word. Clearly having element names that might be reserved words is problematic, but I cannot change the service. I suggest that global reserved words be mangled when creating type properties, for example appending a "_".

da1910 avatar Jul 16 '20 13:07 da1910

@da1910 Did you manage to work around this limitation?

fribor avatar Jul 20 '22 13:07 fribor

Found a solution. You can use kwargs to send the "from".

Example: client.service.Thing(something='value',**{'from':'2020-01-01T00:00:00'})

abaart avatar Feb 17 '24 13:02 abaart