soap request includes a hyphenated field, don't know how to set it
straycat000 at yahoo.com
straycat000 at yahoo.com
Fri Mar 27 03:33:02 EDT 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="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:
>>> event = client.factory.create('ns0:UserVerifiedEvent')
>>> print event
(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
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:
>>> import suds
>>> from suds.client import Client
>>> url = 'http://www.mlb.com/flash/mediaplayer/v4/wsdl/MediaService.wsdl'
>>> 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.)
Thanks,
Matthew
More information about the Python-list
mailing list