I'm porting over code that was developed with suds 0.6
over to zeep 2.4.0
.
Previous suds code:
client = Client(WSDLfile, proxy=proxy, faults=True)
config = client.factory.create('perUserDataExportConfiguration')
config.param1 = 'something'
...
data = client.service.exportPerUserData(username,password,config)
zeep code:
session = requests.Session()
session.verify = False
transport = Transport(session=session)
client = Client(WSDLfile, strict=False, transport=transport)
config = client.type_factory('ns0').perUserDataExportConfiguration()
config.param1 = 'something'
...
data = client.service.exportPerUserData(username,password,config)
Then I get zeep.exceptions.ValidationError: Missing element param_i_didnt_set
. Looking into config.__values__
shows
OrderedDict([('param1', 'something'),
('param_i_didnt_set', None), ...])
The suds
config
object is similar in that it contains a number of keys with empty variables, but suds
doesn't throw ValidationErrors
.
From this Github issue I saw the use of
zeep.xsd.SkipValue
. So I did a replace of any parameter with None inconfig
with that:And then
client.service.exportPerUserData(username,password,config)
worked...