2015-09-17 21 views
0

我正在使用https://github.com/yoavaviram/python-amazon-simple-product-api。 每次返回的項目數是50,即使我使用了search_n(100,...)。任何人都知道爲什麼?在哪裏設置最大數量?由於爲什麼我只能通過python-amazon-product-api.AmazonAPI.search獲得50個項目

amazon = AmazonAPI('key', 
      'key2', 
      'key3', 
      MaxQPS=0.9, 
      Region='US') 
    try: 
      products = amazon.search_n(100, Keywords='drone', SearchIndex='All') 
      for i, product in enumerate(products): 
       print_statement 


    except Exception as e: 
      print "Exception while searching Amazon:"+str(e) 
+0

https://python-amazon-product-api.readthedocs.org/en/latest/上的文檔沒有引用'search_n'方法 - 你確定你沒有使用https:// github .com/yoavaviram/python-amazon-simple-product-api,哪個? –

+0

對不起。已更新。 https://python-amazon-product-api.readthedocs.org/en/latest/每次可以返回50多個項目? – BAE

回答

0

我面臨同樣的問題,這似乎是因爲亞馬遜限制的網頁,以10的數量,以便你可以得到最多100種產品。您可以嘗試優化搜索以更加精確,然後您可以縮小搜索範圍並獲得更多您真正感興趣的產品。

您在那裏搜索的內容太廣泛。試着改變它的東西,如:

products = amazon.search(Keywords='Drone', Title='Drone', SearchIndex='Electronics') 

希望這有助於...

1

亞馬遜documentation約ItemPage參數:

有效值:1到10(1至5時,搜索索引是全部)

0

您可以找到返回頁面的最大數量here
ItemLookup操作的最大頁碼數爲150,ItemSearch的最大頁碼數爲10頁。

+0

儘管這個鏈接可能回答這個問題,但最好在這裏包含答案的基本部分,並提供參考鏈接。如果鏈接頁面更改,則僅鏈接答案可能會失效。請閱讀此[如何回答](http://stackoverflow.com/help/how-to-answer)以提供高質量的答案。 – thewaywewere

相關問題