Skip to content

Commit 638f4d9

Browse files
committed
docs: add asynchronous API support with new usage guide and API reference documentation.
1 parent 0180780 commit 638f4d9

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

docs/amazon_creatorsapi.aio.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Async API module
2+
========================
3+
4+
The async version of the API provides the same functionality as the synchronous API, but uses
5+
``async/await`` for non-blocking operations. Requires ``httpx`` for HTTP requests.
6+
7+
Installation
8+
------------
9+
10+
Install with async support:
11+
12+
.. code-block:: bash
13+
14+
pip install python-amazon-paapi[async] --upgrade
15+
16+
API Reference
17+
-------------
18+
19+
.. autoclass:: amazon_creatorsapi.aio.api.AsyncAmazonCreatorsApi
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ API Reference
2828
.. toctree::
2929

3030
amazon_creatorsapi
31+
amazon_creatorsapi.aio
3132
amazon_creatorsapi.errors
3233

3334
.. toctree::

docs/pages/usage-guide.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,41 @@ api = AmazonCreatorsApi(ID, SECRET, VERSION, TAG, COUNTRY, throttling=4) # Make
100100
api = AmazonCreatorsApi(ID, SECRET, VERSION, TAG, COUNTRY, throttling=0) # No wait time between requests
101101
```
102102

103+
## Async Support
104+
105+
For async/await applications, install with async support:
106+
107+
```bash
108+
pip install python-amazon-paapi[async] --upgrade
109+
```
110+
111+
The async API provides the same methods as the synchronous version:
112+
113+
```python
114+
from amazon_creatorsapi.aio import AsyncAmazonCreatorsApi
115+
from amazon_creatorsapi import Country
116+
117+
# Use as async context manager (recommended for connection pooling)
118+
async with AsyncAmazonCreatorsApi(
119+
credential_id="your_credential_id",
120+
credential_secret="your_credential_secret",
121+
version="2.2",
122+
tag="your-affiliate-tag",
123+
country=Country.US,
124+
) as api:
125+
# All methods work identically, just use await
126+
items = await api.get_items(["B01N5IB20Q"])
127+
results = await api.search_items(keywords="laptop")
128+
variations = await api.get_variations("B01N5IB20Q")
129+
nodes = await api.get_browse_nodes(["667049031"])
130+
131+
# Or use without context manager (creates new connection per request)
132+
api = AsyncAmazonCreatorsApi(ID, SECRET, VERSION, TAG, COUNTRY)
133+
items = await api.get_items(["B01N5IB20Q"])
134+
```
135+
136+
> **Note:** All methods and parameters work identically in async mode. Use `async with` for better performance when making multiple requests.
137+
103138
## Working with Models
104139

105140
All SDK models are re-exported through `amazon_creatorsapi.models` for convenient access:

0 commit comments

Comments
 (0)