Skip to content

johncoleman83/amazon-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c7d52e7 Â· Jul 22, 2020

History

16 Commits
Nov 28, 2017
Jul 22, 2020
Nov 29, 2017
Nov 28, 2017
Nov 27, 2017
Nov 9, 2017
Dec 3, 2017
Nov 27, 2017
Nov 29, 2017
Nov 29, 2017
Nov 28, 2017
Nov 28, 2017
Nov 28, 2017

Repository files navigation

Amazon API

product advertising API & aws IAM API. Demo: https://cecinestpasun.site/amazon/

Description

Python template for Amazon Product Advertising API. I built this for educational purposes only to learn about Amazon's API. The intended use of the Product Advertising API is to direct traffic to amazon.com. Amazon offers payment in exchange for this advertising based on how much traffic your website generates. The API response includes various links with the user's Association Tag and hashed key information in the query string. This is used to verify if the data from your API has generated traffic. See the Demo for real examples.

(the source code also includes an unused example for Amazon IAM AWS API using Amazon AWS IAM credentials)

Disclaimer

  • This is a DEMO Application, for educational use
  • Not for commercial use
  • This is not an official Amazon product nor endorsed by Amazon
  • The author is in no way affiliated with Amazon
  • The author makes no money from this application
    • unless, however, the users click the demo links/advertisements, which then leads to an Amazon purchase.

Environment

  • OS: Linux Ubuntu 16.04.03 LTS (xenial)
  • languages: Python 3.6.3
  • API: Amazon Product Advertising & AWS IAM

Features

  • make request to Product Advertising API
  • make signature with hash function for both API's
  • interpret response

Requirements

  • Python:
$ pip3 install -r requirements.txt

Required Amazon Access Keys

  • Amazon Product Advertising API:

    • Association Tag
    • Unique Access Key ID
    • Secret Key
  • Amazon AWS IAM API:

    • Unique Access Key ID
    • Secret Key

Usage

  • main flask application:
$ ./app.py

use amazon_api python module methods

  • product advertiseing API for item Search
import amazon_api
RESPONSE = amazon_api.item_search(
    [SEARCH_TERM, SEARCH_TERM], BRAND, SEARCH_INDEX
)
AMAZON_OBJECTS = amazon_api.item_search_response_handler(RESPONSE)
  • product advertising API for item Lookup
RESPONSE = amazon_api.item_lookup(ASIN)
AMAZON_OBJECTS = amazon_api.item_lookup_response_handler(RESPONSE)

Helpful Links

Examples:

canonical_querystring = 'AWSAccessKeyId={}&'.format(ACCESS_KEY_ID)
canonical_querystring += 'AssociateTag={}&'.format(MY_ASSOCIATE_TAG)
canonical_querystring += 'ItemId=0679722769&'
canonical_querystring += 'Operation=ItemLookup&'
canonical_querystring += 'ResponseGroup=Images%2CItemAttributes%2COffers%2CReviews'
canonical_querystring += 'Service=AWSECommerceService'
canonical_querystring += 'Timestamp={}&'.format(amzdate)
canonical_querystring += 'Version=2013-08-01'

expected result from EXAMPLE hash:
signature = 'j7bZM0LXZ9eXeZruTqWm2DIvDYVUU3wxPPpp+iXxzQc='

Project Concept from Cracking the Code Interview Prep

  • Take Amazon ID in as input
  • Load Amazon page from internet
  • Possibly in a multithreaded way
  • Extract info with regex
  • Confirm something with user
  • Save images
  • Run tests. Handle errors

License

MIT License

About

📚 amazon product advertising api demo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages