|
| 1 | +# Installation |
| 2 | + |
| 3 | +You can install or upgrade the module with: |
| 4 | + |
| 5 | + pip install python-amazon-paapi --upgrade |
| 6 | + |
| 7 | +# Usage guide |
| 8 | + |
| 9 | +**Basic usage:** |
| 10 | + |
| 11 | +```python |
| 12 | +from amazon_paapi import AmazonApi |
| 13 | +amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY) |
| 14 | +item = amazon.get_items('B01N5IB20Q')[0] |
| 15 | +print(item.item_info.title.display_value) # Item title |
| 16 | +``` |
| 17 | + |
| 18 | +**Get multiple items information:** |
| 19 | + |
| 20 | +```python |
| 21 | +items = amazon.get_items(['B01N5IB20Q', 'B01F9G43WU']) |
| 22 | +for item in items: |
| 23 | + print(item.images.primary.large.url) # Primary image url |
| 24 | + print(item.offers.listings[0].price.amount) # Current price |
| 25 | +``` |
| 26 | + |
| 27 | +**Use URL insted of ASIN:** |
| 28 | + |
| 29 | +```python |
| 30 | +item = amazon.get_items('https://www.amazon.com/dp/B01N5IB20Q') |
| 31 | +``` |
| 32 | + |
| 33 | +**Get item variations:** |
| 34 | + |
| 35 | +```python |
| 36 | +variations = amazon.get_variations('B01N5IB20Q') |
| 37 | +for item in variations.items: |
| 38 | + print(item.detail_page_url) # Affiliate url |
| 39 | +``` |
| 40 | + |
| 41 | +**Search items:** |
| 42 | + |
| 43 | +```python |
| 44 | +search_result = amazon.search_items(keywords='nintendo') |
| 45 | +for item in search_result.items: |
| 46 | + print(item.item_info.product_info.color) # Item color |
| 47 | +``` |
| 48 | + |
| 49 | +**Get browse node information:** |
| 50 | + |
| 51 | +```python |
| 52 | +browse_nodes = amazon.get_browse_nodes(['667049031', '599385031']) |
| 53 | +for browse_node in browse_nodes: |
| 54 | + print(browse_node.display_name) # The name of the node |
| 55 | +``` |
| 56 | + |
| 57 | +**Get the ASIN from URL:** |
| 58 | + |
| 59 | +```python |
| 60 | +from amazon_paapi import get_asin |
| 61 | +asin = get_asin('https://www.amazon.com/dp/B01N5IB20Q') |
| 62 | +``` |
| 63 | + |
| 64 | +**Throttling:** |
| 65 | + |
| 66 | +Throttling value represents the wait time in seconds between API calls, being the default value 1 second. Use it to avoid reaching Amazon request limits. |
| 67 | + |
| 68 | +```python |
| 69 | +amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=4) # Makes 1 request every 4 seconds |
| 70 | +amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=0) # No wait time between requests |
| 71 | +``` |
0 commit comments