soap request includes a hyphenated field, don't know how to set it

straycat000 at straycat000 at
Fri Mar 27 08:33:02 CET 2009

I'm trying to use suds to create a SOAP request.  The request includes
a hyphenated field.  Python won't let me set to hyphenated variables.
Is there a way around this?  Don't tell me to use an underscore
because the SOAP server won't recognize it.

The request is supposed to look like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="
envelope/" xmlns:xsd=""
    <scma:user-verified-media-request xmlns:scma="http://">

Working my way through suds, I have something like this:

>>> event = client.factory.create('ns0:UserVerifiedEvent')
>>> print event
   event-id = None
   user-verified-content[] = <empty>
   domain-specific-attributes =
         domain-attribute[] = <empty>
>>> event.event-id = "164-251340-2009-03-12"
SyntaxError: can't assign to operator

And there's my problem.  I don't know how to set event-id within the
UserVerifiedEvent because of that hyphen.

For anyone who knows suds and SOAP, here's the wsdl to get you this

>>> import suds
>>> from suds.client import Client
>>> url = ''
>>> client = Client(url)

Any ideas or python magic to get around this hyphen problem (and I
can't change that to event_id or the server won't recognize it.)


More information about the Python-list mailing list