我想知道如何删除插入到请求中的元素。
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>
我将如何删除随机元素?
答案 0 :(得分:-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