blob: 044247aa4e228f9e40644af053bc3b193515172c [file] [log] [blame]
import json
from generated import entity_pb2
from google.protobuf.json_format import MessageToDict
#create feed
feed = entity_pb2.EntityFeed()
#create entity
entity = feed.data.add()
entity.entity_id = 'merchant-1'
entity.name = "Mo's Dinner"
entity.telephone = '+14567891234'
entity.url = 'http://moesdinner.com'
#create location
location = entity.location
location.latitude = 41.525588
location.longitude = -90.507067
#create address
address = location.address
address.country = 'US'
address.locality = 'Mountain View'
address.region = 'CA'
address.postal_code = '94043'
address.street_address = '1600 Amphitheatre Pkwy'
feedJSON = json.dumps(MessageToDict(feed, preserving_proto_field_name=True))
print(feedJSON)