def __init__(self, api, soup, Id, ItemId): self.soup = soup.find("div", id=Id) if not self.soup: warnings.warn( "We were not able to find the review HTML for {} perhaps this means " "that the parser is broken. File a bug".format(Id) ) raise ValueError() self.api = api self._asin = ItemId self._id = Id self._url = review_url(self._id)
def __init__(self, api, Id=None, URL=None): if Id and not URL: if 'amazon' in Id: raise ValueError('URL passed as ID') URL = review_url(Id) if not URL: raise ValueError('Invalid review page parameters') self.api = api self._URL = URL self._id = extract_review_id(URL) self._soup = None
def url(self): return review_url(self.id)
def urls(self): return [ review_url(id) for id in self.ids ]