擅长:python、mysql、java
<p>如果您只想获得amazon的结果并将其转换为JSON,那么最好的方法可能是使用bottlenose[<a href="https://github.com/lionheart/bottlenose" rel="nofollow noreferrer">https://github.com/lionheart/bottlenose</a>]。我是这样做的</p>
<pre><code>amazon = bottlenose.Amazon(access_key_id, secret_key, associate_tag)
class AmazonProductsViewSet(viewsets.ViewSet):
def list(self, request, format=None):
response = amazon.ItemSearch(Keywords="Kindle 3G", SearchIndex="All")
return Response(xmltodict.parse(response)) #json.dumps(xmltodict.parse(response))
</code></pre>
<p>现在我将整个XML文档作为JSON。在</p>