3
1
I'm trying to check to see if the variables are being set correctly by the client and being received correctly by me. I'm new to proto buffs and django and my code below doesn't seem to be working. I'm using bitcoin 0.9 I'm trying to capture a refund address.
In views:
from project import payments_pb2
def protoresponse(request):
xpo = payments_pb2.Payment.ParseFromString(request)
returnaddress = xpo.refund_to
transactions = xpo.transactions
memo = xpo.memo
xpa = payments_pb2.PaymentACK
xpa.payment = xpo.SerializeToString()
xpa.memo = 'success'
return HttpResponse(xpa.SerializeToString(), content_type="application/octet-stream")
Any pointers would be greatly appreciated :)
Any information how it doesn't work is necessary for answering the question. – Mikko Ohtamaa – 2014-06-10T14:04:47.337
Thank you for the response :) I receive a 'forbidden access' error once I attempt to send the payment after initially opening the URI, (where to send the payment object is different to the initial URI address). Do I need to do something special to the object like
def protoresponse(request, content_type="application/octet-stream")? Are there any obvious mistakes with the above code? – derrend – 2014-06-10T22:26:07.690Forbidden access is not related to the code above, but is most likely related to your web server. Please study how to setup a basic single web page through Django first, see it works and then try see that your
protoresponseview gets called properly. – Mikko Ohtamaa – 2014-06-11T07:52:18.607It is unlikely the error is any way related to the code or the question above, unless shown otherwise. – Mikko Ohtamaa – 2014-06-11T07:52:45.533
will the protobuffer object come through as a request that I must deserialize - edit - and reserialize before sending back? Please can you give me an example, I cannot find any documentation or forum posts specifically on this subject which is why I am posting here. Thanks :) – derrend – 2014-06-11T09:46:25.143