<commit_before>import logging

from ..parsers.products import GetCompetitivePricingForAsinResponse
from ..requesters.base import raise_for_error
from ..requesters.utils import write_response
from ..mws_overrides import OverrideProducts


class GetCompetitivePricingForAsinRequester(object):

    def __init__(self, access_key, secret_key, account_id,
                 region='US', domain='', uri='', version=''):
        self.logger = logging.getLogger(self.__class__.__name__)
        self.api = OverrideProducts(access_key, secret_key, account_id, region, domain, uri, version)

    @raise_for_error
    def _request(self, asins, marketplaceid):
        response = self.api.get_competitive_pricing_for_asin(asins, marketplaceid)
        write_response(response, 'GetCompetitivePricingForAsinResponse.xml')
        response.raise_for_status()
        return response.content

    def request(self, asins, marketplaceid):
        response = self._request(asins, marketplaceid)
        p = GetCompetitivePricingForAsinResponse.load(response)
        for product in p.products():
            yield product
<commit_msg>Fixed method to request competitive pricing for asin<commit_after>import logging

from ..parsers.products import GetCompetitivePricingForAsinResponse
from ..requesters.base import raise_for_error
from ..requesters.utils import write_response
from ..mws_overrides import OverrideProducts


class GetCompetitivePricingForAsinRequester(object):

    def __init__(self, access_key, secret_key, account_id,
                 region='US', domain='', uri='', version=''):
        self.logger = logging.getLogger(self.__class__.__name__)
        self.api = OverrideProducts(access_key, secret_key, account_id, region, domain, uri, version)

    @raise_for_error
    def _request(self, asins, marketplaceid):
        response = self.api.get_competitive_pricing_for_asin(marketplaceid, asins)
        write_response(response, 'GetCompetitivePricingForAsinResponse.xml')
        response.raise_for_status()
        return response.content

    def request(self, asins, marketplaceid):
        response = self._request(asins, marketplaceid)
        p = GetCompetitivePricingForAsinResponse.load(response)
        for product in p.products():
            yield product

{'fraction_non_alphanumeric': 0.0845442536327609, 'fraction_numerical': 0.0, 'mean_word_length': 4.0941704035874436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1859201', 'n_tokens_mistral': 665, 'n_tokens_neox': 637, 'n_words': 141}