Skip to content

Commit

Permalink
Updated version, changelog and readme format
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioteula committed Mar 25, 2021
1 parent e954002 commit 07b72fe
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 25 deletions.
72 changes: 49 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,69 +39,95 @@ Usage guide
-----------
**Basic usage:**

from amazon.paapi import AmazonAPI
amazon = AmazonAPI(KEY, SECRET, TAG, COUNTRY)
product = amazon.get_product('B01N5IB20Q')
print(product.title)
````python
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)
````python
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')
````python
product = amazon.get_product('https://www.amazon.com/dp/B01N5IB20Q')
````

**Get product variations:**

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

**Search product:**

product = amazon.search_products(item_count=25, keywords='speaker')
print(product[14].url)
````python
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)
````python
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')
````python
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](https://github.com/sergioteula/python-amazon-paapi/blob/master/amazon/paapi.py#L36) 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
````python
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
````python
from amazon.serializers import AmazonProductSerializer
from rest_framework import serializers

serialized_product = AmazonProductSerializer(product)
serialized_product.data
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
````python
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](https://www.django-rest-framework.org/api-guide/serializers/).


Changelog
-------------
Version 3.3.2
- Allow sending several products ids on get_product.
- Updated get_asin for new URL format.
- Added NL region support.
- Removed type hints.

Version 3.3.1
- Allow searching by browse_node or search_index alone.
- Added license files for Amazon SDK.
Expand Down
2 changes: 1 addition & 1 deletion amazon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Amazon Product Advertising API wrapper for Python"""

__version__ = '3.3.1'
__version__ = '3.3.2'
__author__ = 'Sergio Abad'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='python-amazon-paapi',
version='3.3.1',
version='3.3.2',
author='Sergio Abad',
author_email='[email protected]',
description='Amazon Product Advertising API 5.0 wrapper for Python',
Expand Down

0 comments on commit 07b72fe

Please sign in to comment.