现在的情况是,我试图让这个API为我工作,但我似乎无法找出它的所有怪癖。即使我运行下面的例子(取自https://bitbucket.org/basti/python-amazon-product-api/src/2b6b628300c4/examples/all-galileo-titles.py),我也会得到随机错误。现在我得到一个错误,它说__init__()
有4个参数,我只给它两个参数。不过,我将所有凭证放在了正确的位置,并且在模块中找不到__init__()
需要额外参数的任何地方。有人有什么想法吗?在
这是我正在运行的。更多关于该计划的细节可以在上面的链接中找到。在
from amazonproduct.api import API
import lxml
if __name__ == '__main__':
# Don't forget to create file ~/.amazon-product-api
# with your credentials (see docs for details)
api = API(locale = 'uk')
result = api.item_search('Books', Publisher= 'RosettaBooks',
ResponseGroup='Large')
# extract paging information
total_results = result.results
total_pages = len(result) # or result.pages
for book in result:
print 'page %d of %d' % (result.current, total_pages)
#~ from lxml import etree
#~ print etree.tostring(book, pretty_print=True)
print book.ASIN,
print unicode(book.ItemAttributes.Author), ':',
print unicode(book.ItemAttributes.Title),
if hasattr(book.ItemAttributes, 'ListPrice'):
print unicode(book.ItemAttributes.ListPrice.FormattedPrice)
elif hasattr(book.OfferSummary, 'LowestUsedPrice'):
print u'(used from %s)' % book.OfferSummary.LowestUsedPrice.FormattedPrice
我也遇到了同样的问题,我在bitbucket网站上发现了一个关于python amazon产品api的问题,这使我能够解决这个问题。见11/1/2011 new requirement AssociateTag update required?
我所做的工作不是使用.amazon产品api文件指定凭据,而是将其作为api调用的一部分传递:
相关问题 更多 >
编程相关推荐