mcfunley / etsy-python

Python access to the Etsy API
http://developer.etsy.com
GNU General Public License v3.0
65 stars 46 forks source link

Support for Etsy API v2 #1

Closed msabramo closed 13 years ago

msabramo commented 13 years ago

Hi Dan,

Here are changes that I made to etsy-python in order to make it work with Etsy API v2.

I am using this for a Django-powered site that creates Etsy listings from a CSV file. I wrote this site for my sister so that she could save time. As a result, this has been tested but only with a fairly limited set of functionality, primary the createListing and uploadListingImage calls. I am using Python 2.7 -- not sure if anything 2.7-specific crept in there. I did a quick test with Python 2.5 and I was able to create a listing and upload an image to the listing in the Sandbox so that's a good sign.

I haven't tested extensively with different character encodings for titles and descriptions. Actually, my sister was having problems because she was using Windows and so her data had character code \x92 in it, which is a right single quote/apostrophe, U+2019 (8217), in the Windows-1252 character encoding. The Etsy API was choking on this. I tried reencoding the text to UTF-8, but it seems like the Etsy API only allows a limited set of characters in titles and descriptions. So maybe this isn't an issue if Etsy doesn't support Unicode, but you would know better than me.

These changes require the oauth2 package for OAuth support -- http://pypi.python.org/pypi/oauth2/ -- personally, I am using oauth2-1.2.0-py2.7.egg -- I've made oauth2 an optional dependency (i.e.: it's in the "extras_require" section of setup.py) though, since you should in theory be able to use etsy-python just fine without installing oauth2 if you're only doing read-only, unauthenticated operations. Personally, I'm doing pretty much all authenticated operations so I haven't tested much without oauth2.

Thanks for making etsy-python available. I hope that these changes are useful and help to revive etsy-python so that Python developers have a nice API for accessing Etsy.

Regards,

Marc Abramowitz http://marc-abramowitz.com/

mcfunley commented 13 years ago

Looks good at first blush, I'll get it merged and get the pypi package updated ASAP

mcfunley commented 13 years ago

merged

msabramo commented 13 years ago

Would you mind giving me a quick little shout-out in the readme? "Marc Abramowitz (http://marc-abramowitz.com)". I see you mentioned someone else named Ben Dayan, but it looks like you're using my code as well.

msabramo commented 13 years ago

It looks like the readme needs updating for other things too:

Draft - v2 API support not implemented yet.

There are currently two versions of the Etsy API, v1 and v2. This library works with both versions. The
basic interface to either API is the same, although many of the methods are different. In order to use the
v2 API,
mcfunley commented 13 years ago

My bad, that was someone who emailed me a completely different patch apparently. Coming up.

msabramo commented 13 years ago

Thanks for updating the readme! Is it possible to update the pypi page? No big deal if it won't let you update without pushing a new version or something like that.