Diff: AmazonWishListTextBackup

Differences between version 2 and previous revision of AmazonWishListTextBackup.

Other diffs: Previous Major Revision, Previous Author

Newer page: version 2 Last edited on January 19, 2009 4:37 pm by PhilHollenback Revert
Older page: version 1 Last edited on October 26, 2008 11:20 pm by PhilHollenback Revert
@@ -29,4 +29,21 @@
  
 for item in list: 
  print item 
 </verbatim> 
+  
+-----  
+  
+<?plugin RawHtml  
+<center>  
+<script type="text/javascript"><!--  
+google_ad_client = "pub-5011581245921339";  
+google_ad_width = 728;  
+google_ad_height = 90;  
+google_ad_format = "728x90_as";  
+google_ad_channel ="";  
+//--></script>  
+<script type="text/javascript"  
+ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">  
+</script>  
+</center>  
+?>  

version 2

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