【问题标题】:remove element from factory created object python suds从工厂创建的对象 python suds 中删除元素
【发布时间】:2014-11-12 22:29:39
【问题描述】:

我想知道如何删除插入到请求中的元素。

from suds.client import Client

client = Client('http://localhost/Service?wsdl')

lookup = client.factory.create('ns3:retreive')
lookup.person = 'Dave'

这就是泡沫产生的。

<body>
  <retrieve>
    <random>
      <person>Dave</person>
    </random>
  </retrieve>
<body>

如何删除随机元素?

【问题讨论】:

    标签: python xml soap suds


    【解决方案1】:

    这是我如何从请求中删除元素(在本例中为 entityType)的示例:

        # Remove entityType from the search input if it is None.  This is 
        # because if it is None, suds will insert an empty element 
        # (<entityType/>) into the request, which the server doesn't like.
        if searchInput.entityType.value == None:
            del searchInput.entityType
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-17
      • 1970-01-01
      • 2014-05-05
      • 2020-05-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多