Here is a link to the proto file.
Spent a long time trying to figure out the finer points of how the information was being encoded only to realise that if I commented out the HttpResponse
line I still received the same internal server error
message in my bitcoin-qt client when sending test deposits:
from django.views.decorators.csrf import csrf_exempt
from project import payments_pb2
@csrf_exempt
def protoresponse(request):
x = payments_pb2
xpo = x.Payment.FromString(request.body)
xpa = x.PaymentACK()
xpa.payment = xpo
xpa.memo = 'success'
return HttpResponse(xpa.SerializeToString(), content_type="application/bitcoin-paymentack")
I can see nothing wrong with this code but the communication error remains, server error "POST /protoresponse/ HTTP/1.1" 500 58538
.
I placed debug code into the script to check if variables were being set and it worked fine all the way down to xpa.memo = ''success'
so it looks like an error is occurring in the HttpResponse()
method. Either that or something is getting in the way of the response.
Suspect it has something to do with csrf, without the @csrf_exempt
decorator I am presented with a "POST /protoresponse/ HTTP/1.1" 403 2282
error instead.
Any input would be greatly appreciated :)