Skip to content

Commit a30273c

Browse files
committed
Added usage guide to docs
1 parent 396f5ca commit a30273c

3 files changed

Lines changed: 80 additions & 1 deletion

File tree

docs/amazon_paapi.tools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Useful Tools
1+
Tools Module
22
===========================
33

44
.. automodule:: amazon_paapi.tools.asin

docs/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ Reference
1818
amazon_paapi.errors
1919
amazon_paapi.tools
2020

21+
Usage guide
22+
---------------
23+
24+
.. toctree::
25+
:maxdepth: 2
26+
27+
./pages/usage-guide.md
28+
2129
Migration guide
2230
---------------
2331

docs/pages/usage-guide.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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

Comments
 (0)