Created
August 30, 2012 21:17
-
-
Save jaboutboul/3541262 to your computer and use it in GitHub Desktop.
kivikfinder-pullinfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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