remove element from factory created object python suds

751 views Asked by At

I would like to know how to remove an element that is getting inserted into the request.

from suds.client import Client

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

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

This is what suds produces.

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

how would i remove the random element?

1

There are 1 answers

0
Adnan Yaqub On

Here is an example of how I removed an element (in this case entityType) from a request:

    # 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