Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7538359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:06:08+00:00 2026-05-30T07:06:08+00:00

I am trying to submit a response using protocol buffers in python. Below is

  • 0

I am trying to submit a response using protocol buffers in python. Below is the structure.

message BidResponse {
  message Ad {
    optional string html_snippet = 1;
    message TemplateParameter {
      optional string parameter_value = 1;
      optional string blank_ad_parameter_value = 8;
      optional string buyer_creative_id = 2;
      optional string click_through_url = 3;
      optional int32 left = 4;
      optional int32 right = 5;
      optional int32 top = 6;
      optional int32 bottom = 7;
      optional int32 backup_index = 9;
    };
    repeated TemplateParameter template_parameter = 13;
    repeated string click_through_url = 4;
    repeated int32 vendor_type = 5;
    message AdSlot {
      required int32 id = 1;
      required int64 max_cpm_micros = 2;
    }
    repeated AdSlot adslot = 3;
  }
  repeated Ad ad = 2;
  optional int32 processing_time_ms = 4;
}

Now, below is my python code that I am trying to submit.

ms = (time.time() - start)*1000
bid_response = realtime_bidding_pb2.BidResponse()
bid_response.processing_time_ms = int(ms)
ad = bid_response.Ad()
ad.html_snippet = """<img src='http://cdn.test.com/test.gif' />"""
ad.click_through_url = """test.com"""

adslot = ad.AdSlot()
adslot.id = adslots_id[0]             
adslot.max_cpm_micros=150000000

When I submit using the below:

'Content-Type', 'application/octet-stream'
bid_response.SerializeToString()

All that is returned is the bid_response.processing_time_ms.

I suspect I am nt doing repeated and messages correctly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:06:09+00:00Added an answer on May 30, 2026 at 7:06 am

    I remember spending a while hunting this down in my python code a while back. You can find the documentation for the fields interface in python here : http://code.google.com/apis/protocolbuffers/docs/reference/python-generated.html#fields.

    What you want is the add member function – using that your code would look like this:

    ms = (time.time() - start)*1000
    bid_response = realtime_bidding_pb2.BidResponse()
    bid_response.processing_time_ms = int(ms)
    ad = bid_response.ad.add()
    ad.html_snippet = """<img src='http://cdn.test.com/test.gif' />"""
    ad.click_through_url = """test.com"""
    
    adslot = ad.adslot.add()
    adslot.id = adslots_id[0]             
    adslot.max_cpm_micros=150000000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to submit a few forms through a Python script, I'm using the
I'm trying to do a simple echo app using Python. I want to submit
using the jquery below I'm trying to submit the array paramlist to the appropriate
i'm trying to submit my Ajax form using jQuery. However calling the submit() function
I am trying to submit an xhr using phonegap on the blackberry. Currently when
I'm trying to submit a form through AJAX instead of using the normal POST
I'm trying to submit form data with jQuery. I'm using ASP.NET WebMatrix. In a
I am trying to implement ajax in jsp(avoid form submit) using struts2. I used
I am trying to mock the server response for a POST request using Sinon.js.
I've been trying to submit a form with the FormPanel using the Action class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.