2008

2007

2006

2005

2004

Etsy API in Python

▁ mar 22 2008

Currently brewing a small website for my girlfriend and I needed an API to access Etsy. Not knowing much about their policies, I do know that they use Python and PostgreSQL, so that makes them A-OK in my book.

Here’s a quick API that I wrote, and you’re free to grab it. After reading the horror story over on etsytools.com, I’m releasing this bad boy into the public domain; this means that I offer absolutely no guarantee that this continues to work, or anything of the sort. It depends on BeautifulSoup, which is an excellent library, so you should get it anyway.

Sample use:

from pyetsy import Etsy
e = Etsy(5531346) # User ID can be found in your store URI

for item in e.items:
    print item.item_name
    print item.price
    print item.get_image_url("small") # tiny, small, huge

NB: For a while I contemplated having an item.get_url() that would return the URL to the item, alas, those addresses are not mysteriously constructed, as they are just http://www.etsy.com/view_listing.php?listing_id=XXX. Also, note that .items has lazy evaluation, that means that no data will be coming in until you iterate it; it is also cached indefinitely within the object.

Comments are open, have fun.

← Previous: django-sqlalchemy  //  Next: Economist: Copyright is dead

comments

powered by