Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43340 > unrolled thread
| Started by | Ombongi Moraa Fe <moraa.lovetakes2@gmail.com> |
|---|---|
| First post | 2013-04-11 12:06 +0300 |
| Last post | 2013-04-11 12:06 +0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
Return a value from a function result Ombongi Moraa Fe <moraa.lovetakes2@gmail.com> - 2013-04-11 12:06 +0300
| From | Ombongi Moraa Fe <moraa.lovetakes2@gmail.com> |
|---|---|
| Date | 2013-04-11 12:06 +0300 |
| Subject | Return a value from a function result |
| Message-ID | <mailman.449.1365671246.3114.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
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
Back to top | Article view | comp.lang.python
csiph-web