@@ -0,0 +1,2265 @@
+#!/usr/bin/env python3%0A'''%0AAmazon Product Advertising API Client%0A'''%0Afrom xml.etree import ElementTree%0Aimport urllib.parse%0Aimport dewpoint.aws%0Aimport sys%0A%0A%0Adef camel_case(name):%0A    parts = %5B%5D%0A    for part in name.split('_'):%0A        parts.append(part%5B0%5D.upper() + part%5B1:%5D)%0A    return ''.join(parts)%0A%0A%0Aclass ProductAdvertising(object):%0A    def __init__(self, key, secret):%0A        self.api = dewpoint.aws.AWSClient(%0A            key=key,%0A            secret=secret,%0A            version='2013-08-01')%0A%0A    def ItemSearch(self, endpoint, associate_tag, **kwargs):%0A        params = %7B%0A            'Service': 'AWSEcommerceService',%0A            'Operation': 'ItemSearch',%0A            'ContentType': 'text/xml',%0A            'AssociateTag': associate_tag,%0A        %7D%0A%0A        for key in kwargs:%0A            params%5Bcamel_case(key)%5D = kwargs%5Bkey%5D%0A%0A        query = urllib.parse.urlencode(params)%0A        url = '%25s?%25s' %25 (endpoint, query)%0A        status, headers, xml = self.api.request('GET', url)%0A%0A        xml = xml.replace(b' xmlns=%22http://webservices.amazon.com/AWSECommerceService/2013-08-01%22', b'')%0A        tree = ElementTree.XML(xml)%0A        return tree%0A%0Aif __name__ == '__main__':%0A    if len(sys.argv) != 3:%0A        print('Usage: %25s %3Caccess key%3E %3Csecret key%3E' %25 sys.argv%5B0%5D)%0A        sys.exit(1)%0A%0A    access_key = sys.argv%5B1%5D.encode('ascii')%0A    secret_key = sys.argv%5B2%5D.encode('ascii')%0A%0A    pa = ProductAdvertising(access_key, secret_key)%0A%0A    # Change the endpoint depending on your country:%0A    # https://docs.aws.amazon.com/AWSECommerceService/latest/DG/AnatomyOfaRESTRequest.html#EndpointsandWebServices%0A    xml = pa.ItemSearch(%0A            endpoint='https://webservices.amazon.com/onca/xml',%0A            associate_tag='synack-20', %0A            search_index='Electronics',%0A            browse_node='1254762011',%0A            response_group='ItemAttributes,Offers',%0A            sort='salesrank',%0A            item_page=1)%0A    %0A    for element in xml.iterfind('Items/Item'):%0A        asin = element.findtext('ASIN')%0A        name = element.findtext('ItemAttributes/Title')%0A        price = float(element.findtext('Offers/Offer/OfferListing/Price/Amount')) / 100.0%0A        url = element.findtext('DetailPageURL')%0A        print('%25s %25s%5Cn$%25.02f %25s%5Cn' %25 (asin, name, price, url))%0A

Add example for AWS Product Advertising API