Skip to main content

A simple Python wrapper for the Amazon.com Product Advertising API

Project description

(‘Amazon Simple Product API n==========================nA simple Python wrapper for the Amazon.com Product Advertising API. n[![Build Status](https://secure.travis-ci.org/yoavaviram/python-amazon-simple-product-api.png?branch=master)](http://travis-ci.org/yoavaviram/python-amazon-simple-product-api)nnnFeaturesn——–nn* An object oriented interface to Amazon productsn* Supports both item search and item lookupn* Compatible with Google App EnginennnDependenciesn————–nBefore you get started, make sure you have:nn* Installed [Bottlenose](https://github.com/dlo/bottlenose) (pip install bottlenose)n* Installed lxml (pip install lxml)n* An Amazon Product Advertising accountn* An AWS accountnnnUsagen—–nnLookup:nn >>> from amazon.api import AmazonAPIn >>> amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)n >>> product = amazon.lookup(ItemId=”B0051QVF7A”)n >>> product.titlen 'Kindle, Wi-Fi, 6” E Ink Display - for international shipment'n >>> product.price_and_currencyn (109.0, 'USD')n >>> product.eann '0814916014354'n >>> product.large_image_urln 'http://ecx.images-amazon.com/images/I/411H%2B731ZzL.jpg'n >>> product.get_attribute('Publisher')n 'Amazon Digital Services, Inc'n >>> product.get_attributes(['ItemDimensions.Width', 'ItemDimensions.Height'])n {'ItemDimensions.Width': '450', 'ItemDimensions.Height': '34'}nnThe API wrapper supports many other product attributes as well.nnSearch:nn >>> from amazon.api import AmazonAPIn >>> amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)n >>> products = amazon.search(Keywords='kindle', SearchIndex='All')n >>> for i, product in enumerate(products):n >>> print “{0}. '{1}'”.format(i, product.title)n 0. 'Kindle, Wi-Fi, 6” E Ink Display - includes Special Offers & Sponsored Screensavers'n 1. 'Kindle Fire, Full Color 7” Multi-touch Display, Wi-Fi'n 2. 'Kindle US Power Adapter (Not included with Kindle or Kindle Touch)'n 3. 'Kindle Touch, Wi-Fi, 6” E Ink Display - includes Special Offers & Sponsored Screensavers'n 4. 'Kindle Keyboard 3G, Free 3G + Wi-Fi, 6” E Ink Display - includes Special Offers & Sponsored Screensavers'n 5. 'Kindle Touch 3G, Free 3G + Wi-Fi, 6” E Ink Display - includes Special Offers & Sponsored Screensavers'n …n 49. 'Kindle Wireless Reading Device (6” Display, U.S. Wireless)'nnThe search method returns an iterable that will iterate through all products,non all pages available. Additional pages are retrieved automatically as needed.nKeep in mind that Amazon limits the number of pages it makes available.nnFor more information about these calls, please consult the [Product AdvertisingnAPI Developer Guide](http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html).nnThere is also a convenience method to search and return a list of the first N results:nn >>> from amazon.api import AmazonAPIn >>> amazon = AmazonAPI(AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAG)n >>> products = amazon.search_n(1, Keywords='kindle', SearchIndex='All')n >>> len(products)n 1n >>> products[0].titlen 'Kindle, Wi-Fi, 6” E Ink Display - includes Special Offers & Sponsored Screensavers'nnnTestsn——nTo run the test suite please follow these steps:nn* Make sure [Nose](http://readthedocs.org/docs/nose/en/latest/) is installed: (pip install nose)n* Create a local file named: test_settings.py with the following variables set to the relevant values: AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOC_TAGn* Run nosetestsnnLicensen——-nnCopyright © 2012 Yoav AviramnnSee LICENSE for details.nn’,)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page