|
| 1 | +Go OpenRTB 2.1 |
| 2 | +============== |
| 3 | + |
| 4 | +OpenRTB implementation for Go |
| 5 | + |
| 6 | +## Installation |
| 7 | + |
| 8 | +To install, use `go get`: |
| 9 | + |
| 10 | + go get github.com/bsm/openrtb |
| 11 | + |
| 12 | +To update, use `go get -u`: |
| 13 | + |
| 14 | + go get -u github.com/stretchr/testify |
| 15 | + |
| 16 | +Import the package: |
| 17 | + |
| 18 | + package main |
| 19 | + |
| 20 | + import ( |
| 21 | + "github.com/bsm/openrtb" |
| 22 | + ) |
| 23 | + |
| 24 | +## Example |
| 25 | + |
| 26 | + // Handle a HTTP request |
| 27 | + http.HandleFunc("/bid", func(w http.ResponseWriter, r *http.Request) { |
| 28 | + defer r.Body().Close() |
| 29 | + |
| 30 | + req, err := openrtb.ParseRequest(r.Body(), true) |
| 31 | + if err != nil { |
| 32 | + log.Println("ERROR %s", err.Error()) |
| 33 | + } else { |
| 34 | + log.Println("INFO Received bid request %s", *req.Id) |
| 35 | + } |
| 36 | + |
| 37 | + w.WriteHeader(204) // respond with 'no bid' |
| 38 | + }) |
| 39 | + |
| 40 | +## Licence |
| 41 | + |
| 42 | + Copyright (c) 2013 Black Square Media Ltd. All rights reserved. |
| 43 | + (The MIT License) |
| 44 | + |
| 45 | + Permission is hereby granted, free of charge, to any person obtaining |
| 46 | + a copy of this software and associated documentation files (the |
| 47 | + 'Software'), to deal in the Software without restriction, including |
| 48 | + without limitation the rights to use, copy, modify, merge, publish, |
| 49 | + distribute, sublicense, and/or sell copies of the Software, and to |
| 50 | + permit persons to whom the Software is furnished to do so, subject to |
| 51 | + the following conditions: |
| 52 | + |
| 53 | + The above copyright notice and this permission notice shall be |
| 54 | + included in all copies or substantial portions of the Software. |
| 55 | + |
| 56 | + THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
| 57 | + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 58 | + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 59 | + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 60 | + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 61 | + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 62 | + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
0 commit comments