|
1 | | -# Amazon Product Advertising API 5.0 wrapper for Python |
| 1 | +# Python Amazon PAAPI |
2 | 2 |
|
3 | | -A simple Python wrapper for the [last version of the Amazon Product Advertising |
4 | | -API](https://webservices.amazon.com/paapi5/documentation/quick-start/using-sdk.html). |
5 | | -This module allows interacting with Amazon using the official API in an easier way. |
| 3 | +A simple Python wrapper for the [Amazon Product Advertising API 5.0](https://webservices.amazon.com/paapi5/documentation/). Easily interact with Amazon's official API to retrieve product information, search for items, and more. |
6 | 4 |
|
7 | 5 | [](https://pypi.org/project/python-amazon-paapi/) |
8 | | -[](https://www.python.org/) |
| 6 | +[](https://www.python.org/) |
9 | 7 | [](https://github.com/sergioteula/python-amazon-paapi/blob/master/LICENSE) |
10 | 8 | [](https://webservices.amazon.com/paapi5/documentation/) |
11 | | -[](https://pypi.org/project/python-amazon-paapi/) |
| 9 | +[](https://pypi.org/project/python-amazon-paapi/) |
12 | 10 |
|
13 | 11 | ## Features |
14 | 12 |
|
15 | | -- Object oriented interface for simple usage. |
16 | | -- Get information about a product through its ASIN or URL. |
17 | | -- Get item variations or search for products on Amazon. |
18 | | -- Get browse nodes information. |
19 | | -- Get multiple results at once without the 10 items limitation from Amazon. |
20 | | -- Configurable throttling to avoid requests exceptions. |
21 | | -- Type hints to help you coding. |
22 | | -- Support for [all available countries](https://github.com/sergioteula/python-amazon-paapi/blob/956f639b2ab3eab3f61644ae2ca8ae6500881312/amazon_paapi/models/regions.py#L1). |
23 | | -- Ask for new features through the [issues](https://github.com/sergioteula/python-amazon-paapi/issues) section. |
24 | | -- Join our [Telegram group](https://t.me/PythonAmazonPAAPI) for support or development. |
25 | | -- Check the [documentation](https://python-amazon-paapi.readthedocs.io/en/latest/index.html) for reference. |
26 | | -- See the [changelog](https://github.com/sergioteula/python-amazon-paapi/blob/master/CHANGELOG.md) for version history. |
| 13 | +- 🎯 **Simple object-oriented interface** for easy integration |
| 14 | +- 🔍 **Product search** by keywords, categories, or browse nodes |
| 15 | +- 📦 **Product details** via ASIN or Amazon URL |
| 16 | +- 🔄 **Item variations** support (size, color, etc.) |
| 17 | +- 🌍 **20+ countries** supported ([full list](https://github.com/sergioteula/python-amazon-paapi/blob/master/amazon_paapi/models/regions.py)) |
| 18 | +- ⚡ **Batch requests** to get multiple items without the 10-item limit |
| 19 | +- 🛡️ **Built-in throttling** to avoid API rate limits |
| 20 | +- 📝 **Full type hints** for better IDE support |
27 | 21 |
|
28 | 22 | ## Installation |
29 | 23 |
|
30 | | -You can install or upgrade the module with: |
31 | | - |
32 | | - pip install python-amazon-paapi --upgrade |
33 | | - |
34 | | -## Usage guide |
| 24 | +```bash |
| 25 | +pip install python-amazon-paapi --upgrade |
| 26 | +``` |
35 | 27 |
|
36 | | -**Basic usage:** |
| 28 | +## Quick Start |
37 | 29 |
|
38 | 30 | ```python |
39 | 31 | from amazon_paapi import AmazonApi |
| 32 | + |
| 33 | +# Initialize the API (get credentials from Amazon Associates) |
40 | 34 | amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY) |
| 35 | + |
| 36 | +# Get product information by ASIN |
41 | 37 | item = amazon.get_items('B01N5IB20Q')[0] |
42 | | -print(item.item_info.title.display_value) # Item title |
| 38 | +print(item.item_info.title.display_value) |
43 | 39 | ``` |
44 | 40 |
|
45 | | -**Get multiple items information:** |
| 41 | +## Usage Examples |
| 42 | + |
| 43 | +### Get Multiple Products |
46 | 44 |
|
47 | 45 | ```python |
48 | 46 | items = amazon.get_items(['B01N5IB20Q', 'B01F9G43WU']) |
49 | 47 | for item in items: |
50 | | - print(item.images.primary.large.url) # Primary image url |
51 | | - print(item.offers.listings[0].price.amount) # Current price |
| 48 | + print(item.images.primary.large.url) |
| 49 | + print(item.offers.listings[0].price.amount) |
52 | 50 | ``` |
53 | 51 |
|
54 | | -**Use URL instead of ASIN:** |
| 52 | +### Use Amazon URL Instead of ASIN |
55 | 53 |
|
56 | 54 | ```python |
57 | 55 | item = amazon.get_items('https://www.amazon.com/dp/B01N5IB20Q') |
58 | 56 | ``` |
59 | 57 |
|
60 | | -**Get item variations:** |
| 58 | +### Search Products |
61 | 59 |
|
62 | 60 | ```python |
63 | | -variations = amazon.get_variations('B01N5IB20Q') |
64 | | -for item in variations.items: |
65 | | - print(item.detail_page_url) # Affiliate url |
| 61 | +results = amazon.search_items(keywords='nintendo switch') |
| 62 | +for item in results.items: |
| 63 | + print(item.item_info.title.display_value) |
66 | 64 | ``` |
67 | 65 |
|
68 | | -**Search items:** |
| 66 | +### Get Product Variations |
69 | 67 |
|
70 | 68 | ```python |
71 | | -search_result = amazon.search_items(keywords='nintendo') |
72 | | -for item in search_result.items: |
73 | | - print(item.item_info.product_info.color) # Item color |
| 69 | +variations = amazon.get_variations('B01N5IB20Q') |
| 70 | +for item in variations.items: |
| 71 | + print(item.detail_page_url) |
74 | 72 | ``` |
75 | 73 |
|
76 | | -**Get browse node information:** |
| 74 | +### Get Browse Node Information |
77 | 75 |
|
78 | 76 | ```python |
79 | | -browse_nodes = amazon.get_browse_nodes(['667049031', '599385031']) |
80 | | -for browse_node in browse_nodes: |
81 | | - print(browse_node.display_name) # The name of the node |
| 77 | +nodes = amazon.get_browse_nodes(['667049031', '599385031']) |
| 78 | +for node in nodes: |
| 79 | + print(node.display_name) |
82 | 80 | ``` |
83 | 81 |
|
84 | | -**Get the ASIN from URL:** |
| 82 | +### Extract ASIN from URL |
85 | 83 |
|
86 | 84 | ```python |
87 | 85 | from amazon_paapi import get_asin |
| 86 | + |
88 | 87 | asin = get_asin('https://www.amazon.com/dp/B01N5IB20Q') |
| 88 | +# Returns: 'B01N5IB20Q' |
89 | 89 | ``` |
90 | 90 |
|
91 | | -**Throttling:** |
| 91 | +### Configure Throttling |
92 | 92 |
|
93 | | -Throttling value represents the wait time in seconds between API calls, being the |
94 | | -default value 1 second. Use it to avoid reaching Amazon request limits. |
| 93 | +Control the wait time between API calls to avoid rate limits: |
95 | 94 |
|
96 | 95 | ```python |
97 | | -amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=4) # Makes 1 request every 4 seconds |
98 | | -amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=0) # No wait time between requests |
| 96 | +# Wait 4 seconds between requests |
| 97 | +amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=4) |
| 98 | + |
| 99 | +# No throttling (use with caution) |
| 100 | +amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=0) |
99 | 101 | ``` |
100 | 102 |
|
101 | | -## Contribution |
| 103 | +## Documentation |
| 104 | + |
| 105 | +- 📖 [Full Documentation](https://python-amazon-paapi.readthedocs.io/) |
| 106 | +- 📋 [Changelog](https://github.com/sergioteula/python-amazon-paapi/blob/master/CHANGELOG.md) |
| 107 | +- 💬 [Telegram Support Group](https://t.me/PythonAmazonPAAPI) |
| 108 | + |
| 109 | +## Contributing |
102 | 110 |
|
103 | | -Creating pull requests for this repo is highly appreciated to add new features or solve |
104 | | -bugs. To help during development process, follow these steps: |
| 111 | +Contributions are welcome! To get started: |
105 | 112 |
|
106 | 113 | 1. Install [uv](https://docs.astral.sh/uv/) package manager |
107 | | -2. Clone the repository and install dependencies: |
| 114 | +2. Clone and set up the project: |
108 | 115 |
|
109 | 116 | ```bash |
110 | 117 | git clone https://github.com/sergioteula/python-amazon-paapi.git |
111 | 118 | cd python-amazon-paapi |
112 | 119 | uv sync |
113 | | -``` |
114 | | - |
115 | | -3. Set up pre-commit hooks: |
116 | | - |
117 | | -```bash |
118 | 120 | uv run pre-commit install |
119 | 121 | ``` |
120 | 122 |
|
121 | | -4. Copy `.env.template` to `.env` and fill in your Amazon API credentials for integration tests. |
| 123 | +3. Copy `.env.template` to `.env` and add your Amazon API credentials for integration tests. |
122 | 124 |
|
123 | | -The pre-commit hooks will run Ruff (linting and formatting), mypy (type checking), and |
124 | | -tests before each commit. The same checks will also run on the repo with GitHub Actions |
125 | | -to ensure all tests pass before merge. |
| 125 | +Pre-commit hooks will automatically run Ruff, mypy, and tests before each commit. |
126 | 126 |
|
127 | 127 | ## License |
128 | 128 |
|
129 | | -Copyright © 2026 Sergio Abad. See |
130 | | -[license](https://github.com/sergioteula/python-amazon-paapi/blob/master/LICENSE) for |
131 | | -details. |
| 129 | +MIT License © 2026 [Sergio Abad](https://github.com/sergioteula) |
0 commit comments