python-amazon-paapi
raw JSON → 6.2.0 verified Sat May 09 auth: no python
Wrapper for Amazon Product Advertising API 5.0 and Amazon Creators API. Current version 6.2.0, supports Python >=3.9. Active development with regular releases.
pip install python-amazon-paapi Common errors
error NoCredentialsError: No valid credentials provided. ↓
cause Missing or incorrectly set environment variables / parameters for access_key/secret_key/associate_tag.
fix
Ensure AMAZON_ACCESS_KEY, AMAZON_SECRET_KEY, AMAZON_ASSOCIATE_TAG are set correctly in environment or passed to AmazonApi.
error NoResultsError: No results found. ↓
cause API call succeeded but no items matched the search query.
fix
Check keywords, category, or availability parameters. Use broader terms or verify API resource permissions.
error ImportError: cannot import name 'AmazonApi' from 'amazon_paapi' ↓
cause Mistakenly trying to import from a submodule or old module path.
fix
Correct import: from amazon_paapi import AmazonApi
Warnings
breaking Version 6.0.0 deprecated the amazon_paapi module in favor of amazon_creatorsapi for new projects. Old Amazon Product Advertising API 5.0 still works but is deprecated. ↓
fix Use amazon_creatorsapi module for new integrations, but amazon_paapi remains functional.
breaking Exceptions renamed in 5.0.0. For example, NoResultsException was renamed to NoResultsError. ↓
fix Catch new exception names: e.g., except NoResultsError.
gotcha The old amazon module (before amazon_paapi) was removed in 5.0.0. Code relying on from amazon import ... will break. ↓
fix Use from amazon_paapi import AmazonApi and from amazon_paapi.models import ...
gotcha Async support requires installing with [async] extra (pip install python-amazon-paapi[async]) and using amazon_creatorsapi.aio subpackage. ↓
fix Install async extra and import from amazon_creatorsapi.aio.
Install
pip install python-amazon-paapi[async] Imports
- AmazonApi wrong
from amazon_paapi.amazon_paapi import AmazonApicorrectfrom amazon_paapi import AmazonApi - AmazonProduct wrong
from amazon_paapi import AmazonProductcorrectfrom amazon_paapi.models import AmazonProduct
Quickstart
from amazon_paapi import AmazonApi
from dotenv import load_dotenv
import os
load_dotenv()
api = AmazonApi(
access_key=os.environ.get('AMAZON_ACCESS_KEY', ''),
secret_key=os.environ.get('AMAZON_SECRET_KEY', ''),
associate_tag=os.environ.get('AMAZON_ASSOCIATE_TAG', ''),
country='US'
)
products = api.search_items(keywords='Python programming')
if products and products.items:
for item in products.items:
print(item.item_info.title.display_value)