Return a value from a function result

Ombongi Moraa Fe moraa.lovetakes2 at gmail.com
Thu Apr 11 05:06:42 EDT 2013


Hello Team,

My perl script "a.pl" calls python script "b.py" and passes arguments to
it; expecting a return value;

"b.py" uses suds to facilitate soap-based communication with another server
which then returns some value (deliveryStatus)

basically, my b.py script has these 3 major parts;

#part 1 of code to receive arguments from perl script and process them
accordingly
..........
.........
#part 2 of code - function to get delivery status
def deliveryStatus():
           .....
           return parameters # or return client.last_received()

#part 3- print output of the function
print deliveryStatus()



running b.py script with the "return parameters"  prints this output:

[(DeliveryInformation){
   address = "phone_number"
   deliveryStatus = "DeliveredToNetwork"
 }]


running the same script with   "return client.last_received() " instead
prints the soap output

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope>
   <soapenv:Body>
      <ns1:deliveryStatusResp>
         <ns1:result>
            <address>phone_number</address>
            <deliveryStatus>DeliveredToNetwork</deliveryStatus>
         </ns1:result>
      </ns1:deliveryStatusResp>
   </soapenv:Body>
</soapenv:Envelope>


With either kind of output returned to my perl script, my table entry is
updated as "failed" since the returned value is basically an undefined
value; what I need therefore is a way to return only the value
"DeliveredToNetwork" so that the database update on my perl script could be
correct; A solution using either the soap output or the array output will
be appreciated.

Someone help me. Thanks in advance.


Saludos

Ombongi Moraa Faith
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130411/3072e4a9/attachment.html>


More information about the Python-list mailing list