How to return Google protobuff object using python Django

0 votes

I'm ultimately aiming to create a payment request object for bitcoin, I'm not sure of the correct method to return a protobuff response object using Django.

import payments_pb2
x = payments_pb2
x.address = 'home'
return render_to_response(x)

Can someone help me?

Sep 3, 2018 in Blockchain by slayer
• 29,170 points
74 views

1 answer to this question.

0 votes

Protocol buffer is a binary format. You can serve protocol buffer content from django in a similar way to serving pictures, files ...

Example:

def protobuf_view(request):
    ...

    x = payments_pb2
    x.address = 'home'

    return HttpResponse(x.SerializeToString(), content_type="application/octet-stream")
answered Sep 3, 2018 by digger
• 26,550 points

Related Questions In Blockchain

+1 vote
1 answer
0 votes
1 answer

How to resolve blockchain DNS using Python Requests?

You could use one of their publicly ...READ MORE

answered Aug 20, 2018 in Blockchain by Omkar
• 67,660 points
434 views
0 votes
1 answer

How to resolve Blockchain DNS using Python Requests?

Look at this example: import requests from random import ...READ MORE

answered Aug 21, 2018 in Blockchain by Christine
• 15,790 points
82 views
0 votes
1 answer

How to run smart contract function using nethereum to return a result?

Try this: var result = getUserAtIndex.CallAsync<byte[]>(123); READ MORE

answered Oct 24, 2018 in Blockchain by Omkar
• 67,660 points
219 views
0 votes
1 answer

Python request module for bitcoin json rpc

This should work: #!/usr/bin/env python import getpass import json import requests ...READ MORE

answered Aug 28, 2018 in Blockchain by digger
• 26,550 points
284 views
0 votes
1 answer

Cant locate english.txt file while intalling Python Bitcoin module

This is related to a pybitcointools bug where the ...READ MORE

answered Aug 30, 2018 in Blockchain by slayer
• 29,170 points
55 views
0 votes
1 answer
0 votes
1 answer

How to transact custom token instead of ethers using JSON rpc?

First create your custom token. Then develop ...READ MORE

answered Jul 10, 2018 in Blockchain by digger
• 26,550 points
41 views
0 votes
1 answer

How to interact with blockchain using Java web app?

You can interact with the blockchain using ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,550 points
221 views