Suds generates empty elements; how to remove them?

前端 未结 7 1621
傲寒
傲寒 2020-12-31 07:51

[Major Edit based on experience since 1st post two days ago.]

I am building a Python SOAP/XML script using Suds, but am struggling to get the code to generate SOAP/X

7条回答
  •  -上瘾入骨i
    2020-12-31 08:51

    What do you think of the following MonkeyPatch to skip complex types with a None value?

    from suds.mx.literal import Typed
    old_skip = Typed.skip
    def new_skip(self, content):
        x = old_skip(self, content)
        if not x and getattr(content.value, 'value', False) is None:
            x = True
        return x
    Typed.skip = new_skip
    

提交回复
热议问题