示例#1
0
    def __init__(self, pg, usr):
        self.usr = usr

        try:
            items = pg.find(
                "td", "contentModuleHeaderAlt").parent.parent.find_all("tr")
            items.pop(0)

            self.items = []
            for item in items:
                tmpItem = Item(item.find_all("td")[1].text)

                tmpItem.owner = item.td.a.text
                tmpItem.location = item.td.a['href']
                tmpItem.stock = item.find_all("td")[2].text
                tmpItem.price = item.find_all("td")[3].text.replace(
                    " NP", "").replace(",", "")
                tmpItem.id = tmpItem.location.split(
                    "buy_obj_info_id=")[1].split("&")[0]

                self.items.append(tmpItem)
        except Exception:
            logging.getLogger("neolib.shop").exception(
                "Unable to parse shop wizard results.", {'pg': pg})
            raise parseException
示例#2
0
 def __init__(self, pg, usr):
     self.usr = usr
     
     try:
         items = pg.find("td", "contentModuleHeaderAlt").parent.parent.find_all("tr")
         items.pop(0)
         
         self.items = []
         for item in items:
             tmpItem = Item(item.find_all("td")[1].text)
             
             tmpItem.owner = item.td.a.text
             tmpItem.location = item.td.a['href']
             tmpItem.stock = item.find_all("td")[2].text
             tmpItem.price = item.find_all("td")[3].text.replace(" NP", "").replace(",", "")
             tmpItem.id = tmpItem.location.split("buy_obj_info_id=")[1].split("&")[0]
             
             self.items.append(tmpItem)
     except Exception:
         logging.getLogger("neolib.shop").exception("Unable to parse shop wizard results.", {'pg': pg})
         raise parseException