Write a script, which checks prices on two electronics retailers. The script will need to make use of a database backend and allow for historic pricing to be retrieved. The script may be developed in any of the languages covered in the unit.
You will need to select the two electronics retailers, it is suggested that you review the formatting of pages to ensure a site that is consistent and scrapable without an undue amount of additional work. In order to meet the requirements for this assignment they should also have functionality to search for products.
Example commands*:
$ python pricewatch.py update
Detected first run, creating database
Updating prices from Site A
Site A update complete, 23 prices inserted
Updating prices from site B
Site B update complete, 42 prices inserted
$ python pricewatch.py search widget
----------------------------------------------------
| # | Name | Store | Price |
----------------------------------------------------
| 22 | Fancy Widget | Site A | $63.30 |
| 31 | Normal Widget | Site A | $33.90 |
| 42 | Normal Widget | Site B | $21.15 |
----------------------------------------------------
$ python pricewatch.py history 22
Showing history for “Fancy Widget”, from Store A
-------------------------------
| Date | Time | Price |
-------------------------------
| 11/03/2012 | 11:22 | $56.40 |
| 12/03/2012 | 23:14 | $99.95 |
| 15/03/2012 | 01:08 | $63.30 |
-------------------------------
*Note all example commands are assuming that you are writing the software in python, please assume the equivalent for whichever language you select.
You may hard code the details of the sites, regular expressions and the search term you wish to use