AmazonWishListTextBackup

Note: You are viewing an old revision of this page. View the current version.

Here's a python script (based almost entirely on something written by Jon Udell) that queries Amazon's REST interface and generates a text version of your wishlist. The output is all your wishlist items, one per line in the format ISBN Title. Note you need to supply your wishlist ID, which you can find by examining the your wishlist URL on the Amazon website. You also need an Amazon Web Service access key, which you can obtain at the AWS website (it's free).

Obviously this script could be improved tremendously.

#!/usr/bin/python

import urllib2,re

def getAmazonWishlist(aws_access_id,wishlist_id):

  url = 'http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=%s&ListId=%s\
&ListType=WishList&Operation=ListLookup' % (aws_access_id, wishlist_id)

  s = urllib2.urlopen(url).read()

  pages = re.findall('<TotalPages>(.+?)</TotalPages>',s)[0]

  for page in range(int(pages)):
    url = 'http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=%s&ListId=%s\
&ProductPage=%s&ListType=WishList&Operation=ListLookup&ResponseGroup=ListFull' % (aws_access_id, wishlist_id, page+1)

    s += urllib2.urlopen(url).read()

  return re.findall('<ASIN>(.+?)</ASIN>.+?<Title>(.+?)<',s)


list = getAmazonWishlist('<your access id>','<your wishlist id>')

for item in list:
        print item



Our Founder
ToolboxClick to hide/show
RecentChanges Click to hide/show