Created
June 25, 2014 06:41
-
-
Save muzhig/3fff28e70745e901fd21 to your computer and use it in GitHub Desktop.
RTB request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from pprint import pprint | |
import requests | |
rtb_request = { | |
"id": "1234FcDe", | |
"imp": [{ | |
"id": "1", | |
"banner": { | |
"w": 100, # width - this be used as width parameter in request in case of dynamic size placements | |
"h": 100, # height - this be used as width parameter in request in case of dynamic size placements | |
}, | |
"tagid": "1768", # Will be used as placement id in our system, it will be checked and considered as empty bid (204 html status) in case it did not contained a legal placement. | |
# "bidfloor": 0.0, | |
}], | |
"app": { # This or object site should be in request (not both) , this is not used currently on internal ajillionmax implementation. | |
"id": "123fac", | |
"name": "Candy Crush", | |
"bundle": "com.candy.crush", | |
}, | |
"device": { | |
"ua": "Mozilla/5.0 (Linux; U; Android 2.2; zh-cn; HTC_Desire_A8181 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1", # User Agent | |
"ip": "127.0.0.1",#"145.56.12.12", | |
}, | |
# "user": { # this is optional , its id will be used for frequency capping , if exists | |
# "id": "zzz", | |
# }, | |
} | |
print json.dumps(rtb_request) | |
resp = requests.post('http://localhost:8000/ad/rtb/', json.dumps(rtb_request), headers={'X-OPENRTB-VERSION': '2.1'}) | |
print resp.status_code | |
if resp.status_code == 200: | |
print resp.json()['seatbid'][0]['bid'][0]['adm'] | |
else: | |
print resp.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment