the seatbid and bid params from parse the Bid Response protobuf data are array or list (include ‘[]’),but the support team feedback the normal data(parse the Bid Response protobuf data ) only include ’{}‘.why?

17 views
Skip to first unread message

schopenhauer zhang

unread,
Oct 23, 2019, 6:28:06 AM10/23/19
to Protocol Buffers
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。
Reply all
Reply to author
Forward
0 new messages