2012-04-23 26 views
2

我正在使用Google購物API嘗試檢索具有特定數量或近似值的「訂單」數量的產品。例如,如果我想選擇價格在40-60美元之間的產品:$ 50 +/- 10美元。我應該在URL搜索字符串中添加什麼?如何限制谷歌購物API中的價格範圍

我知道我可以通過價格如下(根據API)排名:

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

回答

0

沒關係,這是用瓶和Jinja2的使用Ajax一起做的正確方法。在使用谷歌購物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 
    } 
    ], 
}