2014-11-12 5 views
0

Я хотел бы знать, как удалить элемент, который вставляется в запрос.удалить элемент из созданного на заводе объекта python suds

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

Ниже приведен пример того, как я удалил элемент (в данном случае 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