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,040 points
27 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 27,620 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
• 65,810 points
144 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
27 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
• 65,810 points
100 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
• 27,620 points
131 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,040 points
20 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
• 27,620 points
19 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
• 27,620 points
103 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.