Monitors prices of Amazon products via Product Advertising API. Relies on python-amazon-simple-product-api under the hood.
- Python 2.7, 3.2, 3.3, 3.4
- Django >= 1.5
- Celery >= 3
Add the app "price_monitor" to INSTALLED_APPS:
INSTALLED_APPS = ( ... 'price_monitor', )
The app also supports South.
Amazon account details
You can get these values from the accounts area of your Amazon account.
Add the following settings to your settings file:
AWS_ACCESS_KEY_ID = '<your-aws-access-key>' AWS_SECRET_ACCESS_KEY = '<your-aws-secret-key>'
Set the setting for selecting the Amazon region store and your associate handle:
# possible values: ['US', 'FR', 'CN', 'UK', 'CA', 'DE', 'JP', 'IT', 'ES'] AMAZON_PRODUCT_API_REGION = 'DE' # can be found in your Amazon associate account AMAZON_PRODUCT_API_ASSOC_TAG = '<your-assoc-tag>'
To be able to run the required Celery tasks, Celery itself has to be set up. Please see the Celery Documentation about how to setup the whole thing. You'll need a broker and a result backend configured.
The following tasks are consumed:
This is the Celery task responsible for the synchronization of products:
Syncs the products initially created with only the ASIN and updates products with a last synchronization date older than settings.PRICE_MONITOR_AMAZON_PRODUCT_REFRESH_THRESHOLD_MINUTES (number of minutes). Prices for these products are created, too. Runs by default every 5 minutes, overwrite the run time by setting the PRICE_MONITOR_PRODUCTS_SYNCHRONIZE_TASK_RUN_EVERY_MINUTES setting.
A task for synchronizing a single product. Is called after the creation of new product.
Sends out an email to a single subscriber of a product that has reached the price limit. Is called through ProductSynchronizeTask.
To be able to send out the notification emails, set up a proper email backend (see Django documentation) and set the PRICE_MONITOR_EMAIL_SENDER setting to the email the mails are sent from.
All settings listed
This is a list of all settings that can be overwritten:
|AWS_ACCESS_KEY_ID||Access key to use Amazon Product Advertising API. Can be found in AWS Management Console.||(empty)||yes|
|AWS_SECRET_ACCESS_KEY||Secret access key to use Amazon Product Advertising API. Can be found in AWS Management Console.||(empty)||yes|
|AMAZON_PRODUCT_API_REGION||Region code to use for monitoring products. Set to your country id.||(empty)||yes|
|AMAZON_PRODUCT_API_ASSOC_TAG||Tracking id enable for use with Product Advertising API. Can be found in Amazon PartnerNet account.||(empty)||yes|
|PRICE_MONITOR_EMAIL_SENDER||Email sender address of notification emails.||noreply@localhost||yes|
|PRICE_MONITOR_DEFAULT_CURRENCY||The default currency - used for display in frontend.||EUR||no|
|PRICE_MONITOR_PRODUCT_SYNCHRONIZE_TASK_RUN_EVERY_MINUTES||Run the ProductSynchronizeTask every this minutes.||5||no|
|PRICE_MONITOR_AMAZON_PRODUCT_SYNCHRONIZE_COUNT||Number of products to query with one call to Product Advertising API. Maximum allowed value is 10.||10||no|
|PRICE_MONITOR_AMAZON_PRODUCT_REFRESH_THRESHOLD_MINUTES||Time after which products shall be refreshed (in minutes).||12 * 60||no|
|PRICE_MONITOR_SUBSCRIPTION_RENOTIFICATION_MINUTES||Time after when to notify a user about an already notified subscription again (in minutes).||60 * 24 * 7||no|
|PRICE_MONITOR_I18N_EMAIL_NOTIFICATION_SUBJECT||Notification email subject.||'Price limit for %(product)s reached'||no|
|PRICE_MONITOR_I18N_EMAIL_NOTIFICATION_BODY||Notification email body.||'The price limit of %(price_limit)0.2f %(currency)s has been reached for the article "%(product_title)s" - the current price is %(price)0.2f %(currency)s.\n\nPlease support our platform by using this link for buying: %(link)s\n\n\nRegards,\nThe Team'||no|
|PRICE_MONITOR_SITENAME||The name of your site. Used in price tooltips.||'Price Monitor'||no|
|PRICE_MONITOR_ASIN_REGEX||Regular expression for validating ASINs||'[A-Z0-9]+'||no|
There is a management command to batch create a number of products by providing their ASIN:
python manage.py price_monitor_batch_create_products "<ASIN1>,<ASIN2>,<ASIN3>"
The app uses the logger "price_monitor" to log error and info messages. Please see the Django logging documentation for how to setup loggers.