Skip to content

Instantly share code, notes, and snippets.

@jaboutboul
Created August 30, 2012 21:17
Show Gist options
  • Save jaboutboul/3541262 to your computer and use it in GitHub Desktop.
Save jaboutboul/3541262 to your computer and use it in GitHub Desktop.
kivikfinder-pullinfo
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment