lionheart / bottlenose

A Python wrapper for the Amazon Product Advertising API.
Apache License 2.0
577 stars 112 forks source link

Update readme example to use modified xml2json.xslt #17

Closed tomkinsc closed 11 years ago

tomkinsc commented 12 years ago

See: https://github.com/dlo/bottlenose/issues/2

The example on the bottlenose readme still includes the URI to the "broken" XSLT:

Style="http://xml2json-xslt.googlecode.com/svn/trunk/xml2json.xslt")

Can we add an attribution link in the readme for the xml2json.xslt Google code project, and then change the example Style to point to the new xml2json.xslt file?

Style="http://raw.github.com/dlo/bottlenose/00b7b6eabfd51ed580a644ffb697c65ce2f0568b/xml2json.xslt")
jcalazan commented 12 years ago

Yeah the original link doesn't work properly with ItemSearch. The raw.github.com link didn't work for me, btw. I just hosted the file in my WordPress blog for now. Here's the link if anyone wants to use it for testing: http://www.calazan.com/wp-content/uploads/2012/03/xml2json.xslt

nicksergeant commented 12 years ago

Hmm, I can't get that XSLT to work with any requests now. Anyone else?

greenwasp commented 12 years ago

Me neither.. I was counting on this one. We don't have to explicitly do json.loads() after this, do we?

inactivist commented 11 years ago

I've been unable to make XSLT work in the latest bottlenose.

I'm confused: commit cf50e0b36053cf9a69fd51a7cf1851e7c0e35ef8 claims to "update README since XSLT is no longer supported" - yet the API still supports the Style= parameter.

Why does the bottlenose API accept the Style parameter if XSLT is no longer supported? Or have I misunderstood the commit message?

dlo commented 11 years ago

@inactivist It's my mistake--I haven't removed the parameter itself from the __init__ method. The Style parameter is no longer supported in any capacity.

dlo commented 11 years ago

BTW, closing since Style is no longer supported.

inactivist commented 11 years ago

The Style parameter is no longer supported in any capacity.

@dlo: Thanks for the update. What was the reason for dropping the XSLT support? If this has been discussed elsewhere, please provide a link.

dlo commented 11 years ago

@inactivist I tried to find a thread posted by Amazon itself, but couldn't find one. Here's a post by one of the users of the API on the AWS Product Advertising API forum: https://forums.aws.amazon.com/thread.jspa?messageID=369494

I actually liked the style parameter. I suppose we could "fake" it by running an XSLT transform locally, but I haven't written any code to handle that lately and have just gotten used to using lxml to parse the responses.

inactivist commented 11 years ago

@dlo Thanks for the pointers. I liked the ability to use the XSLT to turn XML into JSON, because like you, I don't care much for XML...

I'll check out LXML...

inactivist commented 11 years ago

I was able to use lxml, but it seemed a bit cumbersome. I'm considering performing the XSLT transform locally as you mentioned earlier.

In the meantime, xmltodict -- found in this SO answer -- appears to be a fine alternative; it converts XML strings into nested OrderedDict instances. This is nearly identical to what simplejson.loads() was doing with the XSLT-transformed JSON strings we were getting when we used the Style= parameter with the XML-to-JSON stylesheet.