Python Amazon Simple Product API

class amazon.api.AmazonCart(parsed_response)[source]

Wrapper around Amazon shopping cart. Allows iterating over Items in the cart.

exception amazon.api.AmazonException[source]

Base Class for Amazon Api Exceptions.

class amazon.api.AmazonProduct(item, aws_associate_tag, api, *args, **kwargs)[source]

A wrapper class for an Amazon product.

actors

Movie Actors.

Returns:A list of actors names.
asin

ASIN (Amazon ID)

Returns:ASIN (string).
author

Author. Depricated, please use authors.

Returns:Author (string).
authors

Authors.

Returns:Returns of list of authors
availability

Availability

Returns:Availability (string).
availability_max_hours

AvailabilityAttributes.MaximumHours

Returns:MaximumHours (string).
availability_min_hours

AvailabilityAttributes.MinimumHours

Returns:MinimumHours (string).
availability_type

AvailabilityAttributes.AvailabilityType

Returns:AvailabilityType (string).
binding

Binding.

Returns:Binding (string)
brand

Brand.

Returns:Brand (string)
browse_nodes

Browse Nodes.

Returns:A list of AmazonBrowseNode objects.
color

Color.

Returns:Color (string)
creators

Creators.

Creators are not the authors. These are usually editors, translators, narrators, etc.

Returns:Returns a list of creators where each is a tuple containing:
  1. The creators name (string).
  2. The creators role (string).
detail_page_url

DetailPageURL.

Returns:DetailPageURL (string)
directors

Movie Directors.

Returns:A list of directors for a movie.
ean

EAN.

Returns:EAN (string)
edition

Edition.

Returns:Edition (string)
editorial_review

Editorial Review.

Returns an editorial review text.

Returns:Editorial Review (string)
editorial_reviews

Editorial Review.

Returns a list of all editorial reviews.

Returns:A list containing:
Editorial Review (string)
eisbn

EISBN (The ISBN of eBooks).

Returns:EISBN (string)
features

Features.

Returns a list of feature descriptions.

Returns:Returns a list of ‘ItemAttributes.Feature’ elements (strings).
formatted_price

FormattedPrice.

Returns:FormattedPrice (string)
genre

Movie Genre.

Returns:The genre of a movie.
get_attribute(name)[source]

Get Attribute

Get an attribute (child elements of ‘ItemAttributes’) value.

Parameters:name – Attribute name (string)
Returns:Attribute value (string) or None if not found.
get_attribute_details(name)[source]

Get Attribute Details

Gets XML attributes of the product attribute. These usually contain details about the product attributes such as units.

Parameters:name – Attribute name (string)
Returns:A name/value dictionary.
get_attributes(name_list)[source]

Get Attributes

Get a list of attributes as a name/value dictionary.

Parameters:name_list – A list of attribute names (strings).
Returns:A name/value dictionary (both names and values are strings).
get_parent()[source]

Get Parent.

Fetch parent product if it exists. Use parent_asin to check if a parent exist before fetching.

Returns:An instance of AmazonProduct representing the parent product.
images

List of images for a response. When using lookup with RespnoseGroup ‘Images’, you’ll get a list of images. Parse them so they are returned in an easily used list format.

Returns:A list of ObjectifiedElement images
is_adult

IsAdultProduct.

Returns:IsAdultProduct (string)
is_preorder

IsPreorder (Is Preorder)

Returns:IsPreorder (string).
isbn

ISBN.

Returns:ISBN (string)
label

Label.

Returns:Label (string)
languages

Languages.

Returns a set of languages in lower-case.

Returns:Returns a set of languages in lower-case (strings).
large_image_url

Large Image URL.

Returns:Large image url (string)
list_price

List Price.

Returns:A tuple containing:
  1. Decimal representation of price.
  2. ISO Currency code (string).
manufacturer

Manufacturer.

Returns:Manufacturer (string)
medium_image_url

Medium Image URL.

Returns:Medium image url (string)
model

Model Name.

Returns:Model (string)
mpn

MPN.

Returns:MPN (string)
number_sellers

Number of offers - New.

Returns:Number of offers - New (string)
offer_id

Offer ID

Returns:Offer ID (string).
offer_url

Offer URL

Returns:Offer URL (string).
pages

Pages.

Returns:Pages (string)
parent_asin

Parent ASIN.

Can be used to test if product has a parent.

Returns:Parent ASIN if product has a parent.
part_number

Part Number.

Returns:Part Number (string)
price_and_currency

Get Offer Price and Currency.

Return price according to the following process:

  • If product has a sale return Sales Price, otherwise,
  • Return Price, otherwise,
  • Return lowest offer price, otherwise,
  • Return None.
Returns:A tuple containing:
  1. Decimal representation of price.
  2. ISO Currency code (string).
product_group

ProductGroup.

Returns:ProductGroup (string)
product_type_name

ProductTypeName.

Returns:ProductTypeName (string)
publication_date

Pubdate.

Returns:Pubdate (datetime.date)
publisher

Publisher.

Returns:Publisher (string)
release_date

Release date .

Returns:Release date (datetime.date)
reviews

Customer Reviews.

Get a iframe URL for customer reviews.

Returns:A tuple of: has_reviews (bool), reviews url (string)
running_time

RunningTime.

Returns:RunningTime (string)
sales_rank

Sales Rank

Returns:Sales Rank (integer).
sku

SKU.

Returns:SKU (string)
small_image_url

Small Image URL.

Returns:Small image url (string)
studio

Studio.

Returns:Studio (string)
tiny_image_url

Tiny Image URL.

Returns:Tiny image url (string)
title

Title.

Returns:Title (string)
upc

UPC.

Returns:UPC (string)
class amazon.api.AmazonSearch(api, aws_associate_tag, **kwargs)[source]

Amazon Search.

A class providing an iterable over amazon search results.

iterate_pages()[source]

Iterate Pages.

A generator which iterates over all pages. Keep in mind that Amazon limits the number of pages it makes available.

Returns:Yields lxml root elements.
exception amazon.api.AsinNotFound[source]

ASIN Not Found Exception.

exception amazon.api.BrowseNodeLookupException[source]

Browse Node Lookup Exception.

exception amazon.api.CartException[source]

Cart related Exception

exception amazon.api.CartInfoMismatchException[source]

HMAC, CartId and AssociateTag did not match

exception amazon.api.LookupException[source]

Lookup Exception.

exception amazon.api.NoMorePages[source]

No More Pages Exception.

exception amazon.api.RequestThrottled[source]

Exception for when Amazon has throttled a request, per: http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ErrorNumbers.html

exception amazon.api.SearchException[source]

Search Exception.

exception amazon.api.SimilartyLookupException[source]

Similarty Lookup Exception.