MCPcopy Index your code
hub / github.com/alefiori82/amazon-paapi5

github.com/alefiori82/amazon-paapi5 @1.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.1.2 ↗ · + Follow
34 symbols 91 edges 7 files 32 documented · 94%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Amazon Product Advertising API 5.0 wrapper for Python

A simple Python wrapper for the last version of the Amazon Product Advertising API. This module allows to get product information from Amazon using the official API in an easier way. Like Bottlenose you can use cache reader and writer to limit the number of api calls.

PyPI Python License Support Amazon API PyPI - Wheel Documentation Status

Features

  • Object oriented interface for simple usage
  • Get multiple products at once
  • Configurable query caching
  • Compatible with Python versions 3.6 and up
  • Support for AU, BR, CA, FR, IN, IT, JP, MX, ES, TR, MX, AE, UK and US Amazon Product Advertising API endpoints
  • Configurable throttling for batches of queries
  • Ask for new features through the issues section.
  • Full documentation on Read the Docs

Installation

You can install or upgrade the module with:

pip install amazon-paapi5 --upgrade

Usage guide

Search items::

from amazon.paapi import AmazonAPI
amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY)
products = amazon.search_items(keywords='harry potter')
print(product['data'][0].image_large)
print(product['data'][1].prices.price)

Get multiple products information::

from amazon.paapi import AmazonAPI
amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY)
products = amazon.get_items(item_ids=['B01N5IB20Q','B01F9G43WU'])
print(products['data']['B01N5IB20Q'].image_large)
print(products['data']['B01F9G43WU'].prices.price)

Get variations::

from amazon.paapi import AmazonAPI
amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY)
products = amazon.get_variations(asin=['B01N5IB20Q','B01F9G43WU'])

Get browse nodes::

from amazon.paapi import AmazonAPI
amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY)
browseNodes = amazon.get_browse_nodes(browse_node_ids=['473535031'])

Use cache reader and writer::

from amazon.paapi import AmazonAPI

DATA = []

def custom_save_function(url, data, http_info):  
    DATA.append({'url':url, 'data': data, 'http_info':http_info})

def custom_retrieval_function(url):  
    for item in DATA:  
        if item["url"] == url: 
            return {'data':item['data'], 'http_info': item['http_info']}  
    return None

amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY, CacheReader=custom_retrieval_function, CacheWriter=custom_save_function) 
products = amazon.search_items(keywords='harry potter')

Changelog

Version 1.1.2
    - License MIT
Version 1.1.1
    - add additional parameters to api calls
Version 1.1.0
    - CacheReader and CacheWriter available for all the search functions
    - Defintion af AmazonException to get exceptions during the api calls
    - Constants defintion
    - AmazonProduct and AmazonBrowseNode definition
    - Uniform data structure returned by all the api calls
Version 1.0.0
    - CacheReader and CacheWriter
    - Enable throttling
Version 0.1.0
    - First release

Buy Me A Coffee

Core symbols most depended-on inside this repo

_cache_url
called by 5
amazon/paapi.py
to_dict
called by 4
amazon/entities.py
parse_response_browse_node
called by 3
amazon/paapi.py
parse_response_item
called by 3
amazon/paapi.py
_quote_query
called by 1
amazon/paapi.py
search_items
called by 1
amazon/paapi.py
to_str
called by 1
amazon/entities.py
to_dict
called by 1
amazon/entities.py

Shape

Method 27
Class 4
Function 3

Languages

Python100%

Modules by API surface

amazon/entities.py20 symbols
amazon/paapi.py11 symbols
amazon/exception.py3 symbols

For agents

$ claude mcp add amazon-paapi5 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page