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

S

straycat000

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="http://schemas.xmlsoap.org/soap/
envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<scma:user-verified-media-request xmlns:scma="http://
services.bamnetworks.com/media/types/2.0">
<scma:event-id>164-251340-2009-03-12</scma:event-id>
<scma:subject>LIVE_EVENT_COVERAGE</scma:subject>
</scma:user-verified-media-request>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Working my way through suds, I have something like this:
(UserVerifiedEvent){
event-id = None
user-verified-content[] = <empty>
domain-specific-attributes =
(MediaAttributes){
domain-attribute[] = <empty>
}
}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
far:

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.)

Thanks,
Matthew
 
J

Justin Ezequiel

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

(UserVerifiedEvent){
   event-id = None
   user-verified-content[] = <empty>
   domain-specific-attributes =
      (MediaAttributes){
         domain-attribute[] = <empty>
      }
 }
SyntaxError: can't assign to operator

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.)

Thanks,
Matthew

haven't tried suds but perhaps you can try

setattr(event, "event-id", "164-251340-2009-03-12")
 
S

straycat000

Working my way through suds, I have something like this:
(UserVerifiedEvent){
   event-id = None
   user-verified-content[] = <empty>
   domain-specific-attributes =
      (MediaAttributes){
         domain-attribute[] = <empty>
      }
 }
event.event-id = "164-251340-2009-03-12"
SyntaxError: can't assign to operator
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.)
Thanks,
Matthew

haven't tried suds but perhaps you can try

setattr(event, "event-id", "164-251340-2009-03-12")

That did it!

Thanks!
Matthew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top