def _loadInventory(self, usr, pg, pgno): rows = pg.find( "form", action="process_safetydeposit.phtml?checksub=scan").find_all("tr") rows.pop(-1) # Last row contains no item for item in rows: stats = item.find_all("td") itemName = stats[1].b.text if itemName.find("(") != -1: itemName = itemName.split("(")[0] tmpItem = Item(itemName) tmpItem.img = stats[0].img['src'] tmpItem.desc = stats[2].text tmpItem.type = stats[3].text tmpItem.stock = stats[4].text tmpItem.id = stats[5].input['name'].split("[")[1].replace("]", "") tmpItem.pg = pgno tmpItem.usr = usr self.items[itemName] = tmpItem
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
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
def _loadInventory(self, usr, pg, pgno): rows = pg.find("form", action = "process_safetydeposit.phtml?checksub=scan").find_all("tr") rows.pop(-1) # Last row contains no item for item in rows: stats = item.find_all("td") itemName = stats[1].b.text if itemName.find("(") != -1: itemName = itemName.split("(")[0] tmpItem = Item(itemName) tmpItem.img = stats[0].img['src'] tmpItem.desc = stats[2].text tmpItem.type = stats[3].text tmpItem.stock = stats[4].text tmpItem.id = stats[5].input['name'].split("[")[1].replace("]", "") tmpItem.pg = pgno tmpItem.usr = usr self.items[itemName] = tmpItem