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,370 points
1,190 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,740 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
• 69,220 points
1,875 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 22, 2018 in Blockchain by Christine
• 15,790 points
1,451 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
• 69,220 points
2,063 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,740 points
2,371 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,370 points
817 views
0 votes
1 answer
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,935 views
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,740 points
1,081 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,740 points
1,202 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP