Saturday, January 15, 2011

Backup your Amazon order history with Python


  1. Nice! I was just busy this week using BeautifulSoup and mechanize to screen-scrape some supermarket sites - will publish a post on it soon. I definitely like the idea of using screen-scraping to back up data that's held on otherwise-closed systems... am lookin' at facebook here...

  2. Facebook actually has a decent API. I wish Amazon had one for this information. Screen scraping always makes me feel dirty ;)

  3. There is a very small off by one bug.

    --- 2011-02-24 16:18:03.000000000 +0000
    +++ 2011-02-24 16:18:13.000000000 +0000
    @@ -55,7 +55,7 @@ if __name__ == '__main__':

    orders = []
    - for year in range(int(options.firstyear),
    + for year in range(int(options.firstyear),
    orders_html ="" % year)
    new_orders = _parse_orders(
    if new_orders:

  4. Amazon recently refreshed their site layout, which makes this script break, but an easy fix is changing the user agent to one for Opera, which they're still serving the old layout to.

  5. I was wondering how I can use this to create a sales report with my amazon account. Thanks.