def noavailableF(html,user_id): soup=BeautifulSoup(html) price=soup.find(id="price1").text.strip() prodName=getProdName(soup) url=soup.find(id="pipUrl").get('href') url=u"http://www.ikea.com"+ url newurl=makeBit(url) location="Contact staff for purchase and information" database.enterItem(user_id,prodName,location,price,newurl) #add item to DB return prodName + "\nLocation: Contact staff for purchase and information" + "\nPrice: " + price + "\nMore Info: " + newurl
def noavailableF(html, user_id): soup = BeautifulSoup(html) price = soup.find(id="price1").text.strip() prodName = getProdName(soup) url = soup.find(id="pipUrl").get('href') url = u"http://www.ikea.com" + url newurl = makeBit(url) location = "Contact staff for purchase and information" database.enterItem(user_id, prodName, location, price, newurl) #add item to DB return prodName + "\nLocation: Contact staff for purchase and information" + "\nPrice: " + price + "\nMore Info: " + newurl
def doubleloc(user_id,locsize,loc,soup): i=0 #counter response="" #response for txt message dbresponse="" #response for database locsize=(locsize/2) #number of locations while (i<locsize): #loop through all locations. pull info and create responses aisle=loc[i].text bin1=loc[i+1].text response=response + "\n %s) Aisle: " %(i+1) + aisle + " Bin: " + bin1 dbresponse=dbresponse+ " %s) Aisle: " %(i+1) + aisle + " Bin: " + bin1 i+=1 price=soup.find(id="price1").text.strip() #pull price prodName=getProdName(soup) url=soup.find(id="pipUrl").get('href') url="http://www.ikea.com"+ url newurl=makeBit(url) #create new URL database.enterItem(user_id,prodName,dbresponse,price,newurl) #add item to the database return prodName + "\nLocations: " + response + "\nPrice: " + price + "\nMore Info: " + newurl
def pullInfo(html,br,user_id,number): soup=BeautifulSoup(html) loc=soup.findAll("div", {"class": "sc_com_locationNo sc_find_it_location_number"}) #find location locsize=len(loc) if(locsize==0): #check for problems findproblems(html,soup,br,user_id,number) if(locsize>2): #check for multiple locations response=doubleloc(user_id,locsize,loc,soup) return sendOut(response,number) aisle=loc[0].text #pull aisle number bin1=loc[1].text #pull location number price=soup.find(id="price1").text.strip() #pull price prodName=getProdName(soup) url=soup.find(id="pipUrl").get('href') url="http://www.ikea.com"+ url newurl=makeBit(url) location="Aisle: " + aisle +" Bin: " +bin1 database.enterItem(user_id,prodName,location,price,newurl) #enter in database return prodName + "\nLocation: " + "Aisle: " + aisle + " Bin: " + bin1 + "\nPrice: " + price + "\nMore Info: " + newurl
def pullInfo(html, br, user_id, number): soup = BeautifulSoup(html) loc = soup.findAll( "div", {"class": "sc_com_locationNo sc_find_it_location_number" }) #find location locsize = len(loc) if (locsize == 0): #check for problems findproblems(html, soup, br, user_id, number) if (locsize > 2): #check for multiple locations response = doubleloc(user_id, locsize, loc, soup) return sendOut(response, number) aisle = loc[0].text #pull aisle number bin1 = loc[1].text #pull location number price = soup.find(id="price1").text.strip() #pull price prodName = getProdName(soup) url = soup.find(id="pipUrl").get('href') url = "http://www.ikea.com" + url newurl = makeBit(url) location = "Aisle: " + aisle + " Bin: " + bin1 database.enterItem(user_id, prodName, location, price, newurl) #enter in database return prodName + "\nLocation: " + "Aisle: " + aisle + " Bin: " + bin1 + "\nPrice: " + price + "\nMore Info: " + newurl
def doubleloc(user_id, locsize, loc, soup): i = 0 #counter response = "" #response for txt message dbresponse = "" #response for database locsize = (locsize / 2) #number of locations while (i < locsize ): #loop through all locations. pull info and create responses aisle = loc[i].text bin1 = loc[i + 1].text response = response + "\n %s) Aisle: " % (i + 1) + aisle + " Bin: " + bin1 dbresponse = dbresponse + " %s) Aisle: " % ( i + 1) + aisle + " Bin: " + bin1 i += 1 price = soup.find(id="price1").text.strip() #pull price prodName = getProdName(soup) url = soup.find(id="pipUrl").get('href') url = "http://www.ikea.com" + url newurl = makeBit(url) #create new URL database.enterItem(user_id, prodName, dbresponse, price, newurl) #add item to the database return prodName + "\nLocations: " + response + "\nPrice: " + price + "\nMore Info: " + newurl