user15533: More specifically, how do I derive the return address from the Output field in a protocol buffer Payment object?
I can convert the serialized byte string from the 'script' field of the Output into a 25 character scriptPubKey but I'm stuck as to where to go from here?
Any help greatly appreciated :)

user15533: I managed it with Petrer Todds python-bitcoinlib.
Link to payments_pb2 proto file here.
import bitcoin

## Uncomment for testnet
#bitcoin.SelectParams('testnet')

import payments_pb2

from bitcoin.wallet import CBitcoinAddress
from bitcoin.core.script import CScript

def protoresponse(httprequest):

    ## Object
    o = payments_pb2

    ## PaymentACK object
    pao = o.PaymentACK()
    pao.payment.ParseFromString(httprequest.body)

    refund_address = CBitcoinAddress.from_scriptPubKey(CScript(pao.payment.refund_to[0].script))

    return httpresponse


15533: <p>More specifically, how do I derive the return address from the Output field in a protocol buffer Payment object?</p>

<p>I can convert the serialized byte string from the 'script' field of the Output into a 25 character scriptPubKey but I'm stuck as to where to go from here?</p>

<p>Any help greatly appreciated :)</p>
 15533: <p>I managed it with Petrer Todds <a href="https://github.com/petertodd/python-bitcoinlib/" rel="nofollow" title="library">python-bitcoinlib</a>.</p>

<p>Link to <code>payments_pb2</code> proto file <a href="https://github.com/bitcoin/bips/blob/master/bip-0070/paymentrequest.proto" rel="nofollow" title="proto file">here</a>.</p>

<pre><code>import bitcoin

## Uncomment for testnet
#bitcoin.SelectParams('testnet')

import payments_pb2

from bitcoin.wallet import CBitcoinAddress
from bitcoin.core.script import CScript

def protoresponse(httprequest):

    ## Object
    o = payments_pb2

    ## PaymentACK object
    pao = o.PaymentACK()
    pao.payment.ParseFromString(httprequest.body)

    refund_address = CBitcoinAddress.from_scriptPubKey(CScript(pao.payment.refund_to[0].script))

    return httpresponse
</code></pre>
