如何限制google shopping API中的价格范围

时间:2012-04-23 08:38:15

标签: google-api url-encoding google-shopping-api

我正在使用Google Shopping API尝试检索具有一定数量的“订单”或近似值的产品。例如,如果我愿意选择价格在40到60美元之间的产品:50美元+/- 10美元。我应该在URL搜索字符串中添加什么内容?

我知道我可以按这样的价格排名(根据API):

     GET https://www.googleapis.com/shopping/search/v1/public/products?key=key&country=US&q=%22mp3+player%22%7Cipod&rankBy=price%3Adescending

1 个答案:

答案 0 :(得分:0)

没关系,正确的做法是使用flask和jinja2以及ajax。在使用Google购物API主要“项目”对象时,必须注意使用JSON以及它如何正确映射到其等效的python对象:

"product": {
  "googleId": "9243781955569725518",
  "author": {
    "name": "CompUPlus.com",
    "accountId": "1209120"
  },
  "creationTime": "2010-03-04T09:51:45.000Z",
  "modificationTime": "2010-11-25T09:24:08.000Z",
  "language": "en",
  "country": "US",
  "title": "Logitech Squeezebox Radio, black",
  "description": "Logitech Squeezebox Radio brings a world of free Internet radio subscription
                  services and your personal digital music collection to any space in your home
                  over your Wi-Fi network.",
  "link": "http://www.compuplus.com/Radios/LOGITECH-Squeezebox-Radio-BLK-930-1115160.html",
  "gtin": "00097855063601",
  "gtins": [
   "00097855063601"
  ],
  "brand": "Logitech",
  "mpn": "930-000101",
  "condition": "new",
  "images": [
    { "link": "http://content.etilize.com/300/1014430207.jpg" }
  ]
  "inventories": [
    {
      "channel": "online",
      "availability": "inStock",
      "currency": "usd",
      "price": 183.19
    }
  ],
}