Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A simple Python wrapper for the last version of the Amazon Product Advertising API. This module allows interacting with Amazon using the official API in an easier way.
You can install or upgrade the module with:
pip install python-amazon-paapi --upgrade
Basic usage:
from amazon_paapi import AmazonApi
amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY)
item = amazon.get_items('B01N5IB20Q')[0]
print(item.item_info.title.display_value) # Item title
Get multiple items information:
items = amazon.get_items(['B01N5IB20Q', 'B01F9G43WU'])
for item in items:
print(item.images.primary.large.url) # Primary image url
print(item.offers.listings[0].price.amount) # Current price
Use URL insted of ASIN:
item = amazon.get_items('https://www.amazon.com/dp/B01N5IB20Q')
Get item variations:
variations = amazon.get_variations('B01N5IB20Q')
for item in variations.items:
print(item.detail_page_url) # Affiliate url
Search items:
search_result = amazon.search_items(keywords='nintendo')
for item in search_result.items:
print(item.item_info.product_info.color) # Item color
Get browse node information:
browse_nodes = amazon.get_browse_nodes(['667049031', '599385031'])
for browse_node in browse_nodes:
print(browse_node.display_name) # The name of the node
Get the ASIN from URL:
from amazon_paapi import get_asin
asin = get_asin('https://www.amazon.com/dp/B01N5IB20Q')
Throttling:
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.
amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=4) # Makes 1 request every 4 seconds
amazon = AmazonApi(KEY, SECRET, TAG, COUNTRY, throttling=0) # No wait time between requests
Creating pull requests for this repo is higly appreciated to add new features or solve bugs. To help during development process, githooks can be activated to run some scripts before pushing new commits. This will run checks for code format and tests, to ensure everything follows this repo guidelines. Use next command to activate them:
git config core.hooksPath .githooks
The same checks will also run on the repo with GitHub Actions to ensure all tests pass before merge.
Copyright © 2021 Sergio Abad. See license for details.
FAQs
Amazon Product Advertising API 5.0 wrapper for Python
We found that python-amazon-paapi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.