如何限制在谷歌购物API价格区间(how to restrict price range in go

2019-09-16 16:24发布

我使用的是谷歌购物API来尝试检索有一定的数量,或者近似如此magnitud的“秩序”的产品。 例如,如果我会选择那些个$ 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

Answer 1:

没关系,用烧瓶中,用的Jinja2沿阿贾克斯这样做的正确的方式是。 一个人必须知道使用JSON的,以及它如何正确地映射到其等效的Python对象,使用谷歌API的购物主要“项目”对象时:

"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
    }
  ],
}


文章来源: how to restrict price range in google shopping API