Skip to main content

Amazon Product Advertising API 5.0 wrapper for Python

Project description

Amazon Product Advertising API 5.0 wrapper for Python

A simple Python wrapper for the last version of the Amazon Product Advertising API. This module allows to get product information from Amazon using the official API in an easier way.

PyPI Python License Support Amazon API

Features

  • Object oriented interface for simple usage.
  • Get information about a product through its ASIN or URL.
  • Get item variations or search for products on Amazon.
  • Get browse nodes information.
  • Get multiple results at once without the 10 items limitation from Amazon.
  • Configurable throttling to avoid requests exceptions.
  • Built-in serializer for Django REST framework.
  • Support for all available countries.
  • Reorganized product information structure for simple use.
  • Ask for new features through the issues section.
  • Join our Telegram group for support or development.

Installation

You can install or upgrade the module with:

pip install python-amazon-paapi --upgrade

If you get ModuleNotFoundError, try installing this:

pip install amightygirl.paapi5-python-sdk

Usage guide

Basic usage:

from amazon.paapi import AmazonAPI
amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY)
product = amazon.get_product('B01N5IB20Q')
print(product.title)

Get multiple product information:

product = amazon.get_products('B01N5IB20Q,B01F9G43WU')
print(product[0].images.large)
print(product[1].prices.price.value)

Use URL insted of ASIN:

product = amazon.get_product('https://www.amazon.com/dp/B01N5IB20Q')

Get product variations:

product = amazon.get_variations('B01N5IB20Q')
print(product[0].title)

Search product:

product = amazon.search_products(item_count=25, keywords='speaker')
print(product[14].url)

Get browse node information:

node = amazon.get_browsenodes(browse_nodes=browsenodes_list)

Get the ASIN from a URL:

from amazon.tools import get_asin
asin = get_asin('https://www.amazon.com/dp/B01N5IB20Q')

Throttling:

Throttling value must be greater than 0 or False to disable it. This value throttles requests to a maximum of one request every 1 / value seconds. Note that this value is a per-worker throttling, so applications with multiple workers may make more requests per second. Throttling value is set by default to 0.8 or one request every 1.25 seconds.

amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY, throttling=0.5)  # Max one request every two seconds
amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY, throttling=False)  # Unlimited requests per second

Serializer for Django:

We provide a serializer for Django REST framework, which speeds up your API implementation.

from amazon.serializers import AmazonProductSerializer
from rest_framework import serializers

serialized_product = AmazonProductSerializer(product)
serialized_product.data

If you want to serialize a list of products:

serialized_products = AmazonProductSerializer(products, many=True)
serialized_products.data

For more information on how to work with serializers, check the documentation for Django REST framework.

License

Copyright © 2020 Sergio Abad. See license for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-amazon-paapi-3.3.3.tar.gz (61.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_amazon_paapi-3.3.3-py3-none-any.whl (181.5 kB view details)

Uploaded Python 3

File details

Details for the file python-amazon-paapi-3.3.3.tar.gz.

File metadata

  • Download URL: python-amazon-paapi-3.3.3.tar.gz
  • Upload date:
  • Size: 61.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for python-amazon-paapi-3.3.3.tar.gz
Algorithm Hash digest
SHA256 ae90b80c7ae827ccbc74f26e778033fde331abcb6194726ebe1a610e72ea5410
MD5 e6b4c16823a2f47f38e997810520f205
BLAKE2b-256 07e56fa6cf9587e312434b5a2040c5c1534281bfd6fe69db86871d3541c87628

See more details on using hashes here.

File details

Details for the file python_amazon_paapi-3.3.3-py3-none-any.whl.

File metadata

  • Download URL: python_amazon_paapi-3.3.3-py3-none-any.whl
  • Upload date:
  • Size: 181.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for python_amazon_paapi-3.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1a3a3211b4e6e0fd0ae526d6ccd7a0861145ff1c09110ab1ef7a40b40672b7c6
MD5 55e2a9a529bbb9932336cdda3d03710a
BLAKE2b-256 e0efc8e8d80ad85b69416265f12edec40c78de58cb8e83f524a4fd9ccad5f04d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page