I use python 3.7 and proto 2.5(openrtb2.0),I set the message from the
proto(https://developers.google.com/authorized-buyers/rtb/downloads/openrtb-proto)
in the proto file,you can see the seatbid and bid is repeated, both of them are
array.but the support team said the seatbid and bid must is {} not [].
the manual address
:https://developers.google.com/protocol-buffers/docs/pythontutorial
my python code :
bidResponse = openrtb_proto_pb2.BidResponse()
bidResponse.id = bid_id
bid_resp = bidResponse.seatbid.add()
bid_resp_bid = bid_resp.bid.add()
bid_resp_bid.id = 'xc' + ":1"
bid_resp_bid.impid = imp_id
bid_resp_bid.price = price
bid_resp_bid.adid = "1"
bid_resp_bid.adm = adm
bid_resp_bid.adomain.extend(["example.com"])
bid_resp_bid.iurl = iurl
bid_resp_bid.cid = str(cid)
bid_resp_bid.crid = crid
bid_resp_bid.bundle = "00"
bid_resp_bid.w = w
bid_resp_bid.h = h
bid_resp_bid.burl = nurl + '&crid=' + crid
bidResponse.cur = "example"
p1 = bidResponse.SerializeToString()
the p1 is result like this(include [] at seatbid and bid params):
id: "ECHO_BIDREQUEST_ID"
seatbid {[
bid [{
id: "BID_ID"
impid: "1"
price: 1.23
adm: "AD_TAG"
adomain: "DECLARED_LANDING_PAGE_URL"
cid: "BILLING_ID"
crid: "CREATIVE_ID"
dealid: "DEAL_ID"
w: 300
h: 250
[com.google.doubleclick.bid] {
impression_tracking_url: "IMPRESSION_TRACKING_URL"
exchange_deal_type: "DEAL_TYPE"
}
}]}]
but I want to get the result is like this(not include []at seatbid or bid
params):
id: "ECHO_BIDREQUEST_ID"
seatbid {
bid {
id: "BID_ID"
impid: "1"
price: 1.23
adm: "AD_TAG"
adomain: "DECLARED_LANDING_PAGE_URL"
cid: "BILLING_ID"
crid: "CREATIVE_ID"
dealid: "DEAL_ID"
w: 300
h: 250
[com.google.doubleclick.bid] {
impression_tracking_url: "IMPRESSION_TRACKING_URL"
exchange_deal_type: "DEAL_TYPE"
}
}
}
how to change my code? Hope your feedback as soon as possible。
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/5f6c10ba-aa76-4608-ac4e-820e2e414c66%40googlegroups.com.